Node.js 为什么在尝试使用nmp安装socket.io时出错

Node.js 为什么在尝试使用nmp安装socket.io时出错,node.js,npm,Node.js,Npm,为什么在尝试安装socket.io时会出现此错误。我正在使用最新版本的NodeJS,并且已经设置了path变量。 我在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) C

为什么在尝试安装socket.io时会出现此错误。我正在使用最新版本的NodeJS,并且已经设置了path变量。 我在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
>ws@0.4.25安装C:\Users\Dusan\node\u modules\socket.io\node\u modules\socket.io
-客户端\节点\模块\ws
>(节点gyp rebuild 2>builderror.log)| |(退出0)
CreateProcessW:系统找不到指定的文件。
npm错误!回滚错误时出错错误:enotery,rmdir'C:\Users\Dusan\node\u模块
\socket.io\node\u modules\socket.io client\node\u modules\active-x-obfuscator\node\m
odules\zeparser'
npm错误!回滚socket.io时出错-client@0.9.11{[Error:enotery,rmdir
'C:\Users\Dusan\node\u modules\socket.io\node\u modules\socket.io client\node\u module
s\active-x-obfuscator\node\u modules\zeparser']
npm ERR!回滚错误号:53,
npm ERR!回滚代码时出错:“e诱惑”,
npm ERR!回滚路径时出错:“C:\\Users\\Dusan\\node\u modules\\socket.io”\\
节点\模块\\socket.io客户端\\节点\模块\\active-x-obfuscator\\node\模块\
\zeparser'}
npm错误!回滚错误:EPERM,rmdir'C:\Users\Dusan\node\u modules\soc
ket.io\node\u modules\socket.io客户端\node\u modules\active-x-obfuscator\node\u module
es\zeparser\benchmark.html'
npm错误!回滚套接字时出错。io@0.9.13{[错误:EPERM,rmdir'C:\Users\D
usan\node\u modules\socket.io\node\u modules\socket.io client\node\u modules\active-x-
混淆器\node\u modules\zeparser\benchmark.html']
npm ERR!回滚错误号:50,
npm ERR!回滚代码“EPERM”时出错,
npm ERR!回滚路径时出错:“C:\\Users\\Dusan\\node\u modules\\socket.io”\\
节点\模块\\socket.io客户端\\节点\模块\\active-x-obfuscator\\node\模块\
\zeparser\\benchmark.html'}
npm错误!ws@0.4.25安装:`(节点gyp rebuild 2>builderror.log)| |(退出0)`
npm错误`cmd“/c”“(节点gyp rebuild 2>builderror.log)| |(退出0)”`failed wi
第127页
npm错误!
npm错误!失败ws@0.4.25安装脚本。
npm错误!这很可能是ws-package的问题,
npm错误!与npm本身无关。
npm错误!告诉作者此操作在您的系统上失败:
npm错误!(节点gyp rebuild 2>builderror.log)| |(退出0)
npm错误!您可以通过以下方式获取他们的信息:
npm错误!npm所有者ls ws
npm错误!上面可能还有其他日志输出。
npm错误!系统Windows\u NT 6.1.7600
npm错误!命令“C:\\ProgramFiles(x86)\\nodejs\\\\node.exe”C:\\ProgramFile
s(x86)\\nodejs\\node\u模块\\npm\\bin\\npm cli.js“安装”socket.io
npm错误!cwd C:\Users\Dusan
npm错误!节点-v v0.8.21
npm错误!npm-V1.2.11
npm错误!代码失效循环
npm错误!错误:enoint,lstat'C:\Users\Dusan\node\u modules\socket.io\node\u module
s\socket.io客户端\node\u模块\active-x-obfuscator\node\u模块\zeparser\benchm
ark.html'
npm错误!如果需要帮助,您可以在以下位置报告此日志:
npm错误!
npm错误!或通过电子邮件发送至:
npm错误!
npm错误!系统Windows\u NT 6.1.7600
npm错误!命令“C:\\ProgramFiles(x86)\\nodejs\\\\node.exe”C:\\ProgramFile
s(x86)\\nodejs\\node\u模块\\npm\\bin\\npm cli.js“安装”socket.io
npm错误!cwd C:\Users\Dusan
npm错误!节点-v v0.8.21
npm错误!npm-V1.2.11
npm错误!路径C:\Users\Dusan\node\u modules\socket.io\node\u modules\socket.io-clien
t\node\u modules\active-x-obfuscator\node\u modules\zeparser\benchmark.html
npm错误!fstream\u路径C:\Users\Dusan\node\u modules\socket.io\node\u modules\socket。
io客户端\node\u模块\active-x-obfuscator\node\u模块\zeparser\benchmark.html
npm错误!fstream_类型文件
npm错误!fstream_类文件编写器
npm错误!代码eNONT
npm错误!埃尔诺34
npm错误!fstream\u堆栈C:\ProgramFiles(x86)\nodejs\node\u modules\npm\node\u module
es\fstream\lib\writer.js:284:26
npm错误!fstream_stack Object.oncomplete(fs.js:297:15)
npm错误!
npm错误!其他日志记录详细信息可在以下位置找到:
npm错误!C:\Users\Dusan\npm-debug.log
npm错误!不正常代码0

我不知道发布这个问题的其他方式。请编辑此项。

我不需要安装node gyp,但您似乎需要。先运行这个

$ npm install -g node-gyp

然后再试一次。如果失败,请重新启动计算机一次以进行路径传播。

尝试将
c:\windows\system32
添加到
路径中。由于您使用cmd作为管理员,因此目录将不同


请参阅socket.io问题,已报告。Windows上的另一个类似问题。

我在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

但它本身并没有解决这个问题。

对于在具有共享文件夹的VM上努力解决这个问题的所有人。这些建议我都没听进去,但过了一段时间,我试着把它安装到另一个不是共享文件夹的地方,一切都完美无缺。或者您可以尝试将它从承载VM的主机安装到该文件夹。希望这将对某人有所帮助。

要使用最新版本的socket.io。。。首先确保您拥有运行节点gyp所需的所有软件:

您可以通过环境变量配置
gyp
使用的Visual Studio版本,从而避免设置
--msvs\u version=2012
属性

示例:

  • 为Visual Studio 2012设置
    GYP\u MSVS\u VERSION=2012
  • set
    GYP\u MSVS\u VERSION=2013e
    (“e”代表“express edition”)
有关完整列表,请参阅 -

这对于NodeJS的Windows用户来说仍然是痛苦的,因为它假设您安装了Python和visualstudio的副本,而许多最终用户永远不会安装。因此,我正在游说Joyent,以鼓励他们将web套接字作为核心节点的一部分,并可能将GNU gcc编译器作为NodeJS安装的一部分提供,这样我们就可以永久解决这个问题

请随时在以下网址添加您的投票: