0

i try to run some samples i found on the net which is old , any way i try to do :

npm install 

but i get some of errors , looking at the builderror.log i see :

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  

as i see there is some kind of version problem , between the node and node-gyp but how can i fix it ? Thanks

UODATE
After running the command :

npm install -g node-gyp@latest

i got no error , but when running the client in the browser i saw that im getting this error :

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)

when looking at the \node_modules\ i do see the file :

\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"
}
user63898
  • 29,839
  • 85
  • 272
  • 514

1 Answers1

0

I think it's not related to node or node-gyp versions.

Node module ws has some c++ code. You can change ws vession to use from master. In master all not pure js codes removed, so you can install it without node-gyp headache.

Ebrahim Pasbani
  • 9,168
  • 2
  • 23
  • 30
  • what c++ ws is using ? how install it? – user63898 Aug 19 '16 at 04:13
  • @user63898 What is output of this command? : `node -p -e \"require('path').dirname(require.resolve('nan')` – Ebrahim Pasbani Aug 19 '16 at 04:16
  • [eval]:1 "require('path').dirname(require.resolve('nan') ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ SyntaxError: Unexpected token ILLEGAL at Object.exports.runInThisContext (vm.js:53:16) at Object. ([eval]-wrapper:6:22) at Module._compile (module.js:541:32) at node.js:333:29 at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9) – user63898 Aug 19 '16 at 04:18
  • This is c++ file to be compiled : https://github.com/websockets/ws/blob/v0.4.30/src/bufferutil.cc. But I recommend to use `master` version which will be version 1 – Ebrahim Pasbani Aug 19 '16 at 04:21
  • i dont understand what i supposed to do ? – user63898 Aug 20 '16 at 18:34
  • @user63898 Use master version so – Ebrahim Pasbani Aug 20 '16 at 18:40
  • @user63898 in `package.json` change like this : `"ws": "websockets/ws"` – Ebrahim Pasbani Aug 20 '16 at 18:48
  • i have no ws in my package.json , i update the question with the package,json – user63898 Aug 22 '16 at 02:26
  • @user63898 Change version of `socket.io` to `1.4.8`. As I've checked, it has no dependecies on `ws` in that version – Ebrahim Pasbani Aug 22 '16 at 03:10
  • No im getting this error which i guess changed in the versions of socket.io this.socketio.configure('production', function () { ^ TypeError: this.socketio.configure is not a function – user63898 Aug 22 '16 at 06:23
  • @user63898 If that sample code is not private could you please share with us to download and play? – Ebrahim Pasbani Aug 22 '16 at 07:53
  • @user63898 It's not compatible with `socket.io@1.4.8` . So you should install the current `ws` version. So please run `npm i nan@1.0.0` first and then `npm i` in root. And don't forget to remove `node_modules` directory before installing `nan` – Ebrahim Pasbani Aug 22 '16 at 10:21
  • Thanks did it , but still have this error : this.socketio.configure('production', function () { ^TypeError: this.socketio.configure is not a function – user63898 Aug 22 '16 at 14:30
  • @user63898 No, I mentioned in my last comment that revert the version of socket.io – Ebrahim Pasbani Aug 22 '16 at 18:15