7

我不得不修改 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"删除错误。

但是,grunt.cmd --version在 Windows 中运行什么也没输出。它只是暂停片刻,然后返回到空白命令行。

我正在运行 Windows 7 64 位,命令行以管理员身份运行

4

2 回答 2

2

首先,您应该grunt-cli全局安装该软件包:

npm install -g grunt-cli

接下来,确保您已grunt安装在项目文件夹中。

您可以通过以下方式做到这一点:

  • 确保grunt是您的一部分package.json并运行:npm install
  • 转到您的项目文件夹,然后npm install grunt

在此之后,运行 Grunt 应该不会有任何问题。

于 2014-01-09T00:17:42.800 回答
1

你安装了 grunt-cli 吗?

我的 grunt.cmd 内容如下所示:

:: Created by npm, please don't edit manually.
@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe"  "%~dp0\node_modules\grunt-cli\bin\grunt" %*
) ELSE (
   node  "%~dp0\node_modules\grunt-cli\bin\grunt" %*
)
于 2013-11-27T12:24:35.727 回答