npm更新package.json会抛出错误

时间:2015-01-08 15:31:36

标签: node.js npm

我在Windows 7下安装了最新版本的节点v0.10.35。此版本包含npm。

当我尝试更新package.json时,收到以下错误:

  

ws@0.4.31安装C:\ Users \ Giuliano \ Downloads \ Rich-Client-Music-Player-master   (node-gyp rebuild 2> builderror.log)|| (退出0)

npm ERR! ws@0.4.31 install: `(node-gyp rebuild 2> builderror.log) || (exit 0)`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the ws@0.4.31 install script.
npm ERR! This is most likely a problem with the ws package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     (node-gyp rebuild 2> builderror.log) || (exit 0)
npm ERR! You can get their info via:
npm ERR!     npm owner ls ws
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\NodeJS\\\\node.exe" "C:\\Program Files\\No
npm ERR! cwd C:\Users\Giuliano\Downloads\Rich-Client-Music-Player-master
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! syscall spawn
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! not ok code 0

我必须承认我已经安装了Microsoft Visual Studio 2013和Python 2.7.9作为此问题的建议。 另外,如果我尝试安装socket.io(npm install socket.io),我会得到同样的错误。我附上了一个npm-debug.log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\NodeJS\\\\node.exe',
1 verbose cli   'C:\\Program Files\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   'socket.io' ]
2 info using npm@1.4.28
3 info using node@v0.10.35
4 verbose node symlink C:\Program Files\NodeJS\\node.exe
5 error Error: ENOENT, stat 'C:\Users\Giuliano\AppData\Roaming\npm'
6 error If you need help, you may report this *entire* log,
6 error including the npm and node versions, at:
6 error     <http://github.com/npm/npm/issues>
7 error System Windows_NT 6.1.7601
8 error command "C:\\Program Files\\NodeJS\\\\node.exe" "C:\\Program Files\\NodeJS\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io"
9 error cwd C:\Users\Giuliano\Desktop
10 error node -v v0.10.35
11 error npm -v 1.4.28
12 error path C:\Users\Giuliano\AppData\Roaming\npm
13 error code ENOENT
14 error errno 34
15 verbose exit [ 34, true ]

1 个答案:

答案 0 :(得分:0)

我不在Windows机器上,但您可以尝试一些解决方案here,例如运行:

$ npm cache clean