Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/405.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript &引用;致命错误:找不到本地咕噜声。”;关于windows7专业版_Javascript_Node.js_Gruntjs_Npm_Installation - Fatal编程技术网

Javascript &引用;致命错误:找不到本地咕噜声。”;关于windows7专业版

Javascript &引用;致命错误:找不到本地咕噜声。”;关于windows7专业版,javascript,node.js,gruntjs,npm,installation,Javascript,Node.js,Gruntjs,Npm,Installation,如果我想启动grunt,我会收到以下消息: c:\repositories\kunde_1\themes-projekt_1\projekt_1-responsive\source>grunt grunt-cli: The grunt command line interface. (v0.1.13) Fatal error: Unable to find local grunt. If you're seeing this message, either a Gruntfile wa

如果我想启动grunt,我会收到以下消息:

c:\repositories\kunde_1\themes-projekt_1\projekt_1-responsive\source>grunt
grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started
运行grunt时,您将看到:

C:\Users\dev_user>npm install -g grunt-cli
npm http GET https://registry.npmjs.org/grunt-cli
npm http 304 https://registry.npmjs.org/grunt-cli
npm http GET https://registry.npmjs.org/nopt
npm http GET https://registry.npmjs.org/findup-sync
npm http GET https://registry.npmjs.org/resolve
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/findup-sync
npm http 304 https://registry.npmjs.org/resolve
npm http GET https://registry.npmjs.org/abbrev
npm http GET https://registry.npmjs.org/glob
npm http GET https://registry.npmjs.org/lodash
npm http 304 https://registry.npmjs.org/abbrev
npm http 304 https://registry.npmjs.org/glob
npm http 304 https://registry.npmjs.org/lodash
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/minimatch
npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/minimatch
npm http GET https://registry.npmjs.org/lru-cache
npm http GET https://registry.npmjs.org/sigmund
npm http 304 https://registry.npmjs.org/lru-cache
npm http 304 https://registry.npmjs.org/sigmund
C:\Users\dev_user\AppData\Roaming\npm\grunt -> C:\Users\dev_user\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
grunt-cli@0.1.13 C:\Users\dev_user\AppData\Roaming\npm\node_modules\grunt-cli
+-- nopt@1.0.10 (abbrev@1.0.7)
+-- resolve@0.3.1
+-- findup-sync@0.1.3 (lodash@2.4.2, glob@3.2.11)
在用户目录中输入grunt:

C:\Users\dev_user>grunt
grunt-cli: The grunt command line interface. (v0.1.13)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

http://gruntjs.com/getting-started
但当我进入项目目录时,同样的信息也出现了

操作系统:windows 7 Professional
npm-版本:1.3.5
节点——版本:v0.10.15

我设置的环境变量:

变量名称:grunt 路径:
C:\Users\dev\u user\AppData\Roaming\npm\grunt
然后推出了新电脑


有人知道为什么消息会出现致命错误:找不到本地咕噜声吗。即将到来?

安装
grunt cli
不会安装grunt任务运行程序
grunt cli
是一个命令行界面,允许在同一台计算机上同时安装多个版本的grunt

要安装
grunt
,您需要通过以下命令全局安装它:

npm install -g grunt
npm install grunt
或通过以下命令在本地执行:

npm install -g grunt
npm install grunt
您在中冷读了关于
grunt cli

来自@Matthew Bakaitis的注释:

不鼓励全局安装grunt

最好的做法是grunt cli首先加载全局版本(如果我记得的话)。如果一个项目需要一个特定版本的grunt,那么全局安装将打破这一点。另外,如果您的构建依赖于grunt,为什么不将其作为依赖项安装并在package.json中列出呢?如果您不在package.json中添加依赖项,那么有一个很大的假设,即其他开发人员或目标系统将在全局范围内安装grunt。考虑到grunt的使用情况,我想不出有多少情况下全局安装会更好


我问题的解决办法。 就我而言,我让一位同事找到了解决办法。 我安装了两个版本的NodeJS,一个旧的1.0.35版本和当前的1.2.7版本。 在Windows卸载程序中,只有一个版本可见! 在我卸载了该版本和所有目录之后,也就是说,旧版本和新版本在当前版本安装冲突后被删除,因为我可以命令shouldnpm install调用。
之后,我可以轻松地调用grunt,它工作正常。

FYI:global安装
grunt
。@MatthewBakaitis您能解释一下原因吗?这是一个很好的做法,因为
grunt cli
首先加载全局版本(如果我记得的话)。如果一个项目需要一个特定版本的grunt,那么全局安装将打破这一点。另外,如果您的构建依赖于grunt,为什么不将其作为依赖项安装并在
package.json
中列出呢?如果您不在
package.json
中作为依赖项添加grunt,则有一个巨大的假设,即其他开发人员或目标系统将在全局范围内安装grunt。考虑到grunt的使用情况,我想不出有多少情况下全局安装会更好。谢谢。我把你的便条加在了答案上。