我尝试运行我在网上发现的一些旧样本,无论我尝试做什么:
npm install
但是我得到了一些错误,看看我看到的builderror.log:
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\dev\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "D:\\dev\\nodejs\\node.exe" "D:\\dev\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\dev\cpp\server\RealtimeMultiplayerNodeJs-master\RealtimeMultiplayerNodeJs-master\node_modules\ws
gyp ERR! node -v v6.2.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
因为我看到节点和node-gyp之间存在某种版本问题 但我该如何解决呢? 感谢
UODATE
运行命令后:
npm install -g node-gyp@latest
我没有错误,但是当在浏览器中运行客户端时,我看到我得到了这个错误:
http://127.0.0.1:8000/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js Failed to load resource: the server responded with a status of 404 (File not found)
查看\ node_modules \我确实看到了文件:
\node_modules\socket.io-client\dist\socket.io.js
Package.json:
{
"name": "RealtimeMultiplayerNodeJs",
"version": "1.1.1",
"description": "RealtimeMultiplayerNodeJS is a framework specifically for building HTML5 multiplayer games with the Client / Server model",
"main": "js/BubbleDots/server.js",
"dependencies": {
"socket.io": "~0.9.16"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs.git"
},
"author": "Mario Gonzalez",
"license": "MIT",
"bugs": {
"url": "https://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs/issues"
},
"homepage": "https://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs"
}
答案 0 :(得分:0)
我认为它与node或node-gyp版本无关。
节点模块ws
有一些c ++代码。您可以从ws
更改master
vession以使用。在master
中删除了所有非纯js代码,因此您可以安装它而不会导致node-gyp
头痛。