Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
133 views
in Technique[技术] by (71.8m points)

javascript - '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:Worksapceweb>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:Worksapceweb>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:Usersuser1234AppDataRoaming
pmgrunt -> C:Usersuser1234AppDataRoaming

pm
ode_modulesgrunt-cliingrunt
[email protected] C:Usersuser1234AppDataRoaming
pm
ode_modulesgrunt-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:Worksapceweb>
E:Worksapceweb>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.

question from:https://stackoverflow.com/questions/25365377/grunt-is-not-recognized-as-an-internal-or-external-command-for-some-windows-us

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...