【发布时间】:2012-10-08 14:42:39
【问题描述】:
我不得不修改 grunt.cmd 因为我的系统路径非常错误:
原来:
%~dp0\Application Data\npm\node_modules\grunt
哪个会打印:
\\dacwnas\Profiles\<user>\Application Data\npm\Application Data\npm\node_modules\grunt
运行 grunt.cmd 会抛出找不到模块错误。将其更改为 %~dp0\node_modules\grunt" 可消除该错误。
但是,在 Windows 中运行 grunt.cmd --version 不会输出任何结果。它只是暂停片刻,然后返回到空白命令行。
我运行的是 Windows 7 64 位,命令行以管理员身份运行
【问题讨论】:
-
你是如何安装 grunt 的?
npm install -g grunt?grunt.cmd文件由 npm 自动生成,不应编辑。更正系统路径后,尝试使用 npm 重新安装 grunt。 -
@KyleRobinsonYoung:如果 npm 第一次把错误的路径放在那里,我不明白为什么如果他重新安装它会做得更好。在我看来,当用户有一个重定向的应用程序数据文件夹时,Grunt 中出现了一个错误。
-
npm 自动生成
grunt.cmd文件时,Grunt 怎么会出bug?他指出的问题,可能是他所有全局安装的节点模块的问题,而不仅仅是 Grunt。如果他更正系统路径并重新安装,npm 应该生成正确的 grunt.cmd 文件。 -
我想远程配置文件是导致问题的原因。我可以手动安装 npm 和 node。我还没有尝试过任何其他软件包,但我认为我会遇到类似的问题。
-
@KyleRobinsonYoung:npm 在创建 grunt.cmd 时如何使用 %PATH%?我没有看到联系。在我看来,它好像正在使用 %APPDATA% 或等效项,并且在它不以驱动器号开头时无法应对。 (但是,我可能应该说 npm 中的错误而不是 Grunt 中的错误。)