【问题标题】:Grunt command no longer recognizedGrunt 命令不再被识别
【发布时间】:2016-11-29 01:08:17
【问题描述】:

我有这个问题,我的咕噜声不再被识别为命令。我一直在寻找解决方案,但大多数问题都说我需要使用我已经使用的 CLI。我在一台安装了 node.js 的计算机上,我目前在我之前的项目中使用它,所以它所在的文件夹没有变化。

C:\Users\fmeloni\Dropbox\Transfer\BananaUnified\sources\Banana>grunt dev
'grunt' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\fmeloni\Dropbox\Transfer\BananaUnified\sources\Banana>grunt --help
'grunt' is not recognized as an internal or external command,
operable program or batch file.

我尝试根据此页面重新安装 npm:http://gruntjs.com/getting-started,但我现在收到警告。

C:\Users\fmeloni\Dropbox\Transfer\BananaUnified\sources\Banana>npm install
npm WARN optional Skipping failed optional dependency /grunt-ts/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@0.3.8
npm WARN Innodirect@1.0.0 No repository field.

然后我尝试了 grunt CLI,结果如下:

C:\Users\fmeloni\Dropbox\Transfer\BananatUnified\sources\Banana>npm install -g grunt-cli
C:\Users\fmeloni\AppData\Roaming\npm\grunt -> C:\Users\fmeloni\AppData\Roaming\npm\node_modules\grunt-cli\bin\grunt
C:\Users\fmeloni\AppData\Roaming\npm
`-- grunt-cli@1.2.0

我已经有 1 周没有使用 grunt 命令了,所以可能有 Windows 更新,但我的机器上没有安装新程序。有没有人对如何解决这个问题有任何想法,或者这些警告与 npm install 的含义是什么。

【问题讨论】:

  • 为了让这篇文章保持最新状态,我已将我的 nom 更新到版本 4.0.2

标签: node.js gruntjs


【解决方案1】:

有一个closed issue 暗示了win 10 的问题。似乎有两种解决方案。

解决了一些问题:

npm update --no-optional

其他人:

rmdir node_modules /s /q
npm i

他们会为你解决吗?

【讨论】:

  • 遗憾的是他们没有,如果有帮助的话,更新版本什么也没做。
  • 你用的是什么版本的node和npm?
  • Npm 3.6.0 和节点 5.6.0 我用 npm 版本获得了这些数字,所以我不确定它们是否正确。
  • 我刚刚检查并there are others 在您的情况下使用节点/npm 的前沿版本。我觉得这可能是 fsevent 和/或 npm 的回归。
  • 谢谢,如果找到解决办法我会在这里补充
【解决方案2】:

问题是由路径问题引起的,所以我只需要添加到我的路径%USERPROFILE%\AppData\Roaming\npm

我不确定它为什么消失了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-26
    • 1970-01-01
    • 1970-01-01
    • 2016-09-09
    • 2015-05-09
    • 2020-01-13
    • 1970-01-01
    • 2019-12-25
    相关资源
    最近更新 更多