gpt4 book ai didi

node.js - windows 10 socket.io安装错误

转载 作者:太空宇宙 更新时间:2023-11-03 22:33:44 24 4
gpt4 key购买 nike

我使用 Windows 10 X64、Python 2.7.10 和 node.js 4.2.0

当我尝试安装 socket.io 时,会显示此错误:

C:\WINDOWS\system32>npm install socket.io

> bufferutil@1.2.1 install C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild


C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp: binding.gyp not found (cwd: C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

> utf-8-validate@1.2.1 install C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild


C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp: binding.gyp not found (cwd: C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\WINDOWS\system32\node_modules\socket.io\node_modules\engine.io\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v4.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing bufferutil@1.2.1
npm WARN optional dep failed, continuing utf-8-validate@1.2.1

> bufferutil@1.2.1 install C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
> node-gyp rebuild

/
C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp: binding.gyp not found (cwd: C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil
gyp ERR! node -v v4.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

> utf-8-validate@1.2.1 install C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate
> node-gyp rebuild


C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
gyp: binding.gyp not found (cwd: C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:355:16)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\WINDOWS\system32\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate
gyp ERR! node -v v4.2.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN optional dep failed, continuing bufferutil@1.2.1
npm WARN optional dep failed, continuing utf-8-validate@1.2.1
socket.io@1.3.7 node_modules\socket.io
├── has-binary-data@0.1.3 (isarray@0.0.1)
├── debug@2.1.0 (ms@0.6.2)
├── socket.io-parser@2.2.4 (isarray@0.0.1, debug@0.7.4, component-emitter@1.1.2, benchmark@1.0.0, json3@3.2.6)
├── socket.io-adapter@0.3.1 (object-keys@1.0.1, debug@1.0.2, socket.io-parser@2.2.2)
├── engine.io@1.5.4 (base64id@0.1.0, debug@1.0.3, engine.io-parser@1.2.2, ws@0.8.0)
└── socket.io-client@1.3.7 (to-array@0.1.3, debug@0.7.4, indexof@0.0.1, component-bind@1.0.0, backo2@1.0.2, object-component@0.0.3, component-emitter@1.1.2, has-binary@0.1.6, parseuri@0.0.2, engine.io-client@1.5.4)

最佳答案

我有 Windows 10 x64。我已经安装了 python 2.7.3 并添加到我的路径中,如nodegyp中所述。我已经安装了 Visual Studio 2013 社区。并且还安装了node-gyp。我在安装 socket.io 或其他 native 模块(如 bcrypt)时仍然遇到错误。

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

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

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

npm install <package name> --msvs_version=2013

关于node.js - windows 10 socket.io安装错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33099826/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com