npm grunt使用不正确的模块路径

时间:2014-09-29 15:26:04

标签: node.js gruntjs npm

我正在尝试使用node.js,npm和grunt。我用npm下载了node.js,从项目目录运行npm install。它运行正常。然后我跑了install npm -g grunt-cli,以'Ok'结束。

我正在使用默认安装和我正确配置的代理后面运行所有这些。

现在尝试从项目目录运行grunt会导致以下错误:

module.js:340
throw err;
      ^
Error: Cannot find module '%APPDATA%\npm\Roaming\npm\node_modules\grunt-cli'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

注意,它会在搜索路径中再次插入Roaming\npm。是否有配置设置在哪里获得此路径?是什么导致它将Roaming \ npm附加到前缀路径?

npm config get prefix:%APPDATA%\ npm

NODE_PATH环境变量设置为%APPDATA%\ npm

我也试过npm cache clean

编辑:我更改了%APPDATA%\ grunt.cmd文件。现在它获得了正确的路径,但错误仍然存​​在。它说%APPDATA%\node_modules\grunt-cli找不到,但它就在那里。

1 个答案:

答案 0 :(得分:0)

这是由于path模块中的错误造成的。请看这里:grunt issue

相关问题