“Fatal error: Unable to find local grunt.” on Windows 7

旧街凉风 提交于 2019-12-04 08:51:01

I know its been 2 years since this question was asked. However if someone wants in future:

I got the exact same issue. And I got this fixed by installing grunt locally. As per grunt site,

Note that installing grunt-cli does not install the Grunt task runner! The job of the Grunt CLI is simple: run the version of Grunt which has been installed next to a Gruntfile. This allows multiple versions of Grunt to be installed on the same machine simultaneously.

So I just got it working by installing Grunt locally.

npm install grunt --save-dev

--save : adds it to your package.json.

-dev: adds it as a dev dependency.

There must be a Gruntfile.js located in the directory you run the command from. Also double check that 'npm install grunt' actually gave you a node_modules directory with a sub directory called grunt.

Vijay

You should install grunt in GUI mode.

Open node.js cmd prompt then open the root folder and run the below commands

  1. npm install ( once it done you can able to see node_modules folder in the root folder)

  2. npm install –g grunt-cli (change the version from ("version": "minified" to Current release("version":"1.11"); you should replace with minified once you run build)

  3. grunt build:full

Note: Version has to change when running grunt very first time.

if the above answer do not works then you can try by using this

rm -rf node_modules/ && npm cache clean && npm install
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!