& # 39;繁重# 39;不能被某些Windows用户识别为内部或外部命令
'grunt' is not recognized as an internal or external command for some windows users
Grunt不适用于所有Windows用户。当我运行npm install
命令时,一些用户面临一些问题;它打印如下信息:
E:'Worksapce'web>npm install
npm WARN package.json registers@4.0.0 No repository field.
当我尝试npm install -g grunt-cli
时,我认为它是成功的。
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时,我得到这样的错误消息:
E:'Worksapce'web>
E:'Worksapce'web>grunt
'grunt' is not recognized as an internal or external command,
operable program or batch file.
我的包。Json是这样的
{
"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"
}
}
另一个用户能够成功执行grunt,没有任何问题。这只代表部分用户。
谁能告诉我出了什么事
Grunt不再被全局安装。有关更多信息,请参阅入门页。
下面的命令可以帮助你解决这个问题;
npm install -g grunt-cli
日志显示在全局目录下创建了grunt
命令。这些错误还表明C:'Users'mc862634'AppData'Roaming'npm'
不在您的路径中。
你要检查你的PATH
,并确保'AppData'Roaming'npm
的位置被添加,如果它是缺失的。
最简单的检查方法是打开命令提示符并输入PATH
。
查看这个其他StackOverflow问题作为参考:Grunt在Windows 8: ' Grunt '不被识别
在Windows 8上,Grunt需要在PATH
中添加以下内容:
C:'Users'your_username'AppData'Roaming'npm
在某些系统上,PATH中允许的字符数是有限的,这可能导致没有添加grunt所需的正确路径,即使在运行npm install -g grunt-cli
之后也是如此。有些设置(例如您已经安装的某些程序)可以安全地从PATH中删除,因为它们通常是作为故障保险存在的,通常不是必需的。如果您有此问题:
- 备份
PATH
中的变量(本PC>右键单击>属性>高级系统设置>环境变量> '编辑'当前用户的'路径'用户变量,并复制'变量值'并将其保存在某处) - 从
PATH
中删除一些值,并添加路径C:'Users'your_username'AppData'Roaming'npm
另外,请确保在安装Grunt CLI并添加路径后,在尝试Grunt
Grunt-CLI
安装在%AppData%'npm中,所以添加到%PATH%
的最佳目录是:
%AppData%'npm
npm install grunt -g(或)npm install -g grunt-cli请检查您的计算机环境变量路径,它应该包含AppData的路径。例:E: ' $ APPDATA ' npm ';
我的电脑->右键单击->属性->高级系统设置->环境变量->路径
如果有一些使用Windows XP的开发人员有类似的问题,您需要更改Path条目。
从>:C:'Users' change_username ' AppData '漫游' npm '繁重:C:'Documents and Settings' change_username'Application Data'npm
- 内部分区字体大小获胜'调整浏览器窗口大小时不会随媒体查询而更改
- 如何识别我的网站中的慢速设备
- Google/html5语音识别JavaScript SDK Chrome网络工具包SpeechRecognition
- 调用函数内部的函数
- 如何使用js将SNAPSHOT内部版本号转换为3位数的整数
- 在phonegap应用程序内部重定向不起作用
- 使用此选项选择父类内部的类
- 访问JSON对象内部的数组元素
- angular/javascript无法识别函数内部的全局变量
- 为什么内部 html 的 src 属性无法识别我的动态生成的变量
- JavaScript,无法识别的字符,内部带有扩展运算符 reduce
- 为什么没有识别全局变量(内部函数)
- '调试'不被识别为流星的内部命令
- 在最近的更新与代码传输停止工作后:tsc未被识别为内部或外部命令
- 'cocos'在我的项目目录中未被识别为内部或外部命令
- JQuery,操作无法识别函数内部的变量
- 内部Javascript在使用c#的Asp.net中无法识别,但在Vb.net中已重新定位
- & # 39;繁重# 39;不能被某些Windows用户识别为内部或外部命令
- Angular无法识别提供者内部的函数
- PHP内部无法识别JavaScript