繁体   English   中英

为什么尝试使用nmp安装socket.io时出现错误

[英]Why do I get error when trying to install socket.io with nmp

为什么在尝试安装socket.io时出现此错误。 我正在使用最新版本的NodeJS,并设置了路径变量。 我在cmd中使用具有管理员权限的Windows 7。

> ws@0.4.25 install C:\Users\Dusan\node_modules\socket.io\node_modules\socket.io
-client\node_modules\ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

CreateProcessW: The system cannot find the file specified.
npm ERR! error rolling back Error: ENOTEMPTY, rmdir 'C:\Users\Dusan\node_modules
\socket.io\node_modules\socket.io-client\node_modules\active-x-obfuscator\node_m
odules\zeparser'
npm ERR! error rolling back  socket.io-client@0.9.11 { [Error: ENOTEMPTY, rmdir
'C:\Users\Dusan\node_modules\socket.io\node_modules\socket.io-client\node_module
s\active-x-obfuscator\node_modules\zeparser']
npm ERR! error rolling back   errno: 53,
npm ERR! error rolling back   code: 'ENOTEMPTY',
npm ERR! error rolling back   path: 'C:\\Users\\Dusan\\node_modules\\socket.io\\
node_modules\\socket.io-client\\node_modules\\active-x-obfuscator\\node_modules\
\zeparser' }
npm ERR! error rolling back Error: EPERM, rmdir 'C:\Users\Dusan\node_modules\soc
ket.io\node_modules\socket.io-client\node_modules\active-x-obfuscator\node_modul
es\zeparser\benchmark.html'
npm ERR! error rolling back  socket.io@0.9.13 { [Error: EPERM, rmdir 'C:\Users\D
usan\node_modules\socket.io\node_modules\socket.io-client\node_modules\active-x-
obfuscator\node_modules\zeparser\benchmark.html']
npm ERR! error rolling back   errno: 50,
npm ERR! error rolling back   code: 'EPERM',
npm ERR! error rolling back   path: 'C:\\Users\\Dusan\\node_modules\\socket.io\\
node_modules\\socket.io-client\\node_modules\\active-x-obfuscator\\node_modules\
\zeparser\\benchmark.html' }
npm ERR! ws@0.4.25 install: `(node-gyp rebuild 2> builderror.log) || (exit 0)`
npm ERR! `cmd "/c" "(node-gyp rebuild 2> builderror.log) || (exit 0)"` failed wi
th 127
npm ERR!
npm ERR! Failed at the ws@0.4.25 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.7600
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io"
npm ERR! cwd C:\Users\Dusan
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.11
npm ERR! code ELIFECYCLE
npm ERR! Error: ENOENT, lstat 'C:\Users\Dusan\node_modules\socket.io\node_module
s\socket.io-client\node_modules\active-x-obfuscator\node_modules\zeparser\benchm
ark.html'
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>

npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "socket.io"
npm ERR! cwd C:\Users\Dusan
npm ERR! node -v v0.8.21
npm ERR! npm -v 1.2.11
npm ERR! path C:\Users\Dusan\node_modules\socket.io\node_modules\socket.io-clien
t\node_modules\active-x-obfuscator\node_modules\zeparser\benchmark.html
npm ERR! fstream_path C:\Users\Dusan\node_modules\socket.io\node_modules\socket.
io-client\node_modules\active-x-obfuscator\node_modules\zeparser\benchmark.html
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! fstream_stack C:\Program Files (x86)\nodejs\node_modules\npm\node_modul
es\fstream\lib\writer.js:284:26
npm ERR! fstream_stack Object.oncomplete (fs.js:297:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\Users\Dusan\npm-debug.log
npm ERR! not ok code 0

我不知道发布此问题的其他方法。 请编辑。

尝试将c:\\windows\\system32添加到PATH 由于您将cmd用作管理员,因此目录将有所不同。

请参阅在此处报告的socket.io问题。 Windows on SO上的另一个类似问题。

对于所有在具有共享文件夹的VM上为此苦苦挣扎的人。 我没有遵循这些建议的运气,但是一段时间后,我尝试将其安装到不是共享文件夹的另一个位置,并且一切正常。 或者,您可以尝试从将VM托管到该文件夹​​的主计算机上安装它。 希望这会帮助某人。

我在Mac上也有类似的问题。 解决我问题的原因是安装了稍旧的Socket.io版本。

我做了:

npm install socket.io@"~0.8.1"

它将安装介于0.8.0到0.8.9之间的最新版本,但不能安装0.9.0或更高版本。

Socket.io then installed perfectly.

我也装了

sudo npm install -g node-gyp

但是它本身并不能解决问题。

我不需要安装node-gyp,但看起来就像您一样。 先运行这个

$ npm install -g node-gyp

然后再试一次。 如果失败,请重新引导计算机一次以进行PATH传播。

要使用最新版本的socket.io ...,请首先确保您具有运行node-gyp所需的所有软件:

您可以配置使用的Visual Studio版本gyp通过环境变量,所以你可不必设置--msvs_version=2012属性。

例子:

  • 为Visual Studio 2012设置GYP_MSVS_VERSION=2012 2012
  • 设置GYP_MSVS_VERSION=2013e (“ e”代表“ GYP_MSVS_VERSION=2013e版”)

有关完整列表,请参见-https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294

对于NodeJS的Windows用户来说,这仍然很痛苦,因为它假定您已经安装了Python和Visual Studio的副本,并且许多最终用户永远都不会拥有它。 因此,我正在游说Joyent,鼓励他们将Web套接字作为CORE节点的一部分包括在内,并可能将GNU gcc编译器作为NodeJS安装的一部分提供,以便我们可以永久解决此问题。

随时添加您的投票:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM