简体   繁体   中英

Error running Grunt on Windows : Fatal error: Unable to find local grunt

I know there are lots of questions about this problem, but mine is a bit different.

I have nodejs installed on Windows , at c:\\program files\\nodejs

I installed all desired modules in the folder above, using these commands :

npm install grunt --save-dev
npm install grunt-contrib-uglify --save-dev
npm install grunt-contrib-cssmin
npm install grunt-contrib-imagemin --save-dev

If i go inside my app folder and try to execute grunt, i get this error :

Fatal error: Unable to find local grunt

Grunt will run only if i reinstall all modules INSIDE the folder of my app.

My question is : i have to install the modules inside EVERY app folder ? The same modules already installed on nodejs folder arent'enough ?

Thanks !

Yes, the modules should be installed inside project directory. If you want to install node module globally, you should use --global flag, eg npm install --global grunt . But installing grunt and grunt modules globally isn't good idea because of dependency management. You may get into trouble when update grunt or grunt modules installed globally.

Read grunt Getting Started for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM