通过npm安装Socket.io时出错

时间:2015-02-07 18:05:58

标签: node.js socket.io npm

我在Node.js中安装Socket.io时收到以下消息

npm install --save socket.io
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: node-v0.10.35.tar.gz local checksum efd2c6bfd05834bca81175fa1b6374898c95c9e2a57597e6ac3a8594d37bc4a0 not match remote 0043656bb1724cb09dbdc960a2fd6ee37d3badb2f9c75562b2d11235daa40a03
gyp ERR! stack     at deref (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\install.js:299:20)
gyp ERR! stack     at Request.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\install.js:409:24)
gyp ERR! stack     at Request.emit (events.js:117:20)
gyp ERR! stack     at IncomingMessage.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\request\request.js:1096:12)
gyp ERR! stack     at IncomingMessage.emit (events.js:117:20)
gyp ERR! stack     at _stream_readable.js:944:16
gyp ERR! stack     at process._tickCallback (node.js:442:13)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\ruchi data\My Programs\meanstack\socket\node_modules\socket.io\node_modules\engine.io\node_modules\ws
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

1 个答案:

答案 0 :(得分:0)

我有windows 10 x64。我安装了python 2.7.3并添加到我的路径中,如nodegyp中所述。我已经安装了visual studio 2013社区。并且还安装了node-gyp。我在安装socket.io或其他本机模块时遇到错误,比如bcrypt。

然后我尝试通过以下命令安装socket.io

npm install --save socket.io --msvs_version=2013

这解决了问题并安装了socket.io而没有任何错误。诀窍是

npm install <package name> --msvs_version=2013