Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'grunt' is not recognized as an internal or external command for some windows users

Grunt is not working for all Windows users. Some users are facing some issues, when I run npm install command; it prints a message as below.

E:\Worksapce\web>npm install npm WARN package.json [email protected] No repository field. 

When I tried npm install -g grunt-cli, I think it is successful.

E:\Worksapce\web>npm install -g grunt-cli npm http GET http://registry.npmjs.org/grunt-cli npm http 304 http://registry.npmjs.org/grunt-cli npm http GET http://registry.npmjs.org/nopt npm http GET http://registry.npmjs.org/findup-sync npm http GET http://registry.npmjs.org/resolve npm http 304 http://registry.npmjs.org/nopt npm http 304 http://registry.npmjs.org/resolve npm http 304 http://registry.npmjs.org/findup-sync npm http GET http://registry.npmjs.org/abbrev npm http 304 http://registry.npmjs.org/abbrev npm http GET http://registry.npmjs.org/glob npm http GET http://registry.npmjs.org/lodash npm http 304 http://registry.npmjs.org/glob npm http 304 http://registry.npmjs.org/lodash npm http GET http://registry.npmjs.org/inherits npm http GET http://registry.npmjs.org/minimatch npm http 304 http://registry.npmjs.org/minimatch npm http 304 http://registry.npmjs.org/inherits npm http GET http://registry.npmjs.org/lru-cache npm http GET http://registry.npmjs.org/sigmund npm http 304 http://registry.npmjs.org/lru-cache npm http 304 http://registry.npmjs.org/sigmund C:\Users\user1234\AppData\Roaming\npm\grunt -> C:\Users\user1234\AppData\Roaming \npm\node_modules\grunt-cli\bin\grunt [email protected] C:\Users\user1234\AppData\Roaming\npm\node_modules\grunt-cli +-- [email protected] +-- [email protected] ([email protected]) +-- [email protected] ([email protected], [email protected]) 

But when I run grunt, I get an error message like this:

E:\Worksapce\web> E:\Worksapce\web>grunt 'grunt' is not recognized as an internal or external command, operable program or batch file. 

My package.json is this.

{   "author": "Company",   "name": "registers",   "version": "4.0.0",   "homepage": "http://abcd.se",   "dependencies": {},   "devDependencies": {     "grunt": "~0.4.4",     "grunt-contrib-jshint": "~0.9.2",     "grunt-contrib-watch": "~0.6.1",     "grunt-contrib-less": "~0.11.0",     "grunt-contrib-clean": "~0.5.0",     "grunt-contrib-copy": "~0.5.0",     "grunt-contrib-concat": "~0.3.0",     "grunt-contrib-uglify": "~0.4.0",     "grunt-ngmin": "0.0.3",     "grunt-contrib-jasmine": "~0.5.2"   } } 

Another user is succesfully able to execute grunt with out any issues. This only stands for some of the users.

Can some one tell me what has gone wrong.

like image 660
Patan Avatar asked Aug 18 '14 14:08

Patan


People also ask

How do I install grunt?

Installing a published development version Like installing a specific version of grunt, run npm install grunt@VERSION --save-dev where VERSION is the version you need, and npm will install that version of Grunt in your project folder, adding it to your package.

How do I download grunt from command line?

Installing the CLI. Run sudo npm install -g grunt-cli (Windows users should omit "sudo ", and may need to run the command-line with elevated privileges). The grunt command-line interface comes with a series of options. Use grunt -h from your terminal to show these options.


2 Answers

Grunt is no longer installed globally. See the Getting Started page for more information.

The command below should help you fix this;

npm install -g grunt-cli 
like image 191
Aditi Avatar answered Sep 26 '22 01:09

Aditi


Your logs indicate that the grunt command was created in your global directory. The errors also indicate that C:\Users\mc862634\AppData\Roaming\npm\ is not in your path.

You'll want to check your PATH and make sure that the \AppData\Roaming\npm location is added if it is missing.

The easiest way to check is to open a command prompt and type PATH.

See this other StackOverflow question as a reference: Grunt on Windows 8: 'grunt' is not recognized

like image 43
Matthew Bakaitis Avatar answered Sep 26 '22 01:09

Matthew Bakaitis