尝试在 Windows 上使用 npm 安装 yo

Azz*_*ude 5 node.js npm yeoman

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

npm install -g yo
Run Code Online (Sandbox Code Playgroud)

...命令提示符返回以下内容:

> 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
Run Code Online (Sandbox Code Playgroud)

有谁知道这到底意味着什么以及我该如何解决它?

bil*_*ash 0

您可以尝试使用此:https ://github.com/npm/npm/issues/7781

我想这会帮助你解决你的问题。

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