对于某些Windows用户,“grunt”不被识别为内部或外部命令 [英] 'grunt' is not recognized as an internal or external command for some windows users

查看:141
本文介绍了对于某些Windows用户,“grunt”不被识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Grunt不适用于所有Windows用户。有些用户在运行 npm install 命令时遇到了一些问题;它打印一条消息如下。

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 registers@4.0.0 No repository field.

当我尝试 npm install -g grunt-cli

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
grunt-cli@0.1.13 C:\Users\user1234\AppData\Roaming\npm\node_modules\grunt-cli
+-- resolve@0.3.1
+-- nopt@1.0.10 (abbrev@1.0.5)
+-- findup-sync@0.1.3 (lodash@2.4.1, glob@3.2.11)

但是当我运行grunt时,出现如下错误消息:

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.

我的package.json就是这样。

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.

推荐答案

Grunt不再全局安装。有关更多信息,请参阅使用入门页面。

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

这篇关于对于某些Windows用户,“grunt”不被识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆