尝试在 Windows 上使用 npm 安装 yo

Trying to install yo with npm on Windows

我在 Windows 并尝试按照 http://yeoman.io/learning/index.html 上的说明进行操作。到目前为止,我已经成功安装了 grunt-cli 和 bower,但是当我尝试使用以下命令安装 yo 时...

npm install -g yo

...命令提示符 returns 这个:

> spawn-sync@1.0.11 postinstall C:\Users\Aaron\AppData\Roaming\npm\node_modules\yo\node_modules\cross-spawn\node_modules\spawn-sync
> node postinstall

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "yo"
npm ERR! node v0.12.4
npm ERR! npm  v2.10.1
npm ERR! file ;C:\Windows\system32\cmd.exe
npm ERR! path ;C:\Windows\system32\cmd.exe
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn ;C:\Windows\system32\cmd.exe

npm ERR! spawn-sync@1.0.11 postinstall: `node postinstall`
npm ERR! spawn ;C:\Windows\system32\cmd.exe ENOENT
npm ERR!
npm ERR! Failed at the spawn-sync@1.0.11 postinstall script 'node postinstall'.
npm ERR! This is most likely a problem with the spawn-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node postinstall
npm ERR! You can get their info via:
npm ERR!     npm owner ls spawn-sync
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Aaron\AppData\Roaming\npm\node_modules\npm-debug.log

有谁知道这到底是什么意思,我该如何解决?

你可以试试这个:https://github.com/npm/npm/issues/7781

我认为这将帮助您解决问题。

并在 cmd 中获取节点和 npm。您可以在 windows 环境变量中设置节点位置。然后重新启动您的 cmd 并再次尝试执行此操作。

尝试使用功能 npm 包管理器重新安装设置,然后返回到您的 npm 安装。