Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update websocket fork (node-gyp err output on Windows / Node 12) #3371

Closed
user535353 opened this issue Feb 10, 2020 · 16 comments · Fixed by #3534
Closed

Update websocket fork (node-gyp err output on Windows / Node 12) #3371

user535353 opened this issue Feb 10, 2020 · 16 comments · Fixed by #3534
Assignees
Labels
1.x 1.0 related issues
Projects

Comments

@user535353
Copy link

Expected behavior

npm install command is executed without errors

Actual behavior

npm install shows errors

Steps to reproduce the behavior

  1. npm init
  2. npm install web 3

Logs

@web3-js/websocket@1.0.30 install C:\Temp\web3.test\node_modules@web3-js\websocket
(node-gyp rebuild 2> builderror.log) || (exit 0)

C:\Temp\web3.test\node_modules@web3-js\websocket>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
bufferutil.cc
win_delay_load_hook.cc
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(34,1): error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Users\dummyuser\AppData\Local\node-gyp\Cache\12.14.1\include\node\v8.h(5995,46): message : see declaration of 'v8::FunctionTemplate::GetFunction' (compiling source file ..\src\bufferutil.cc) [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(34,1): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(50,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(57,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(68,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(70,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(89,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(90,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(92,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(93,1): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Users\dummyuser\AppData\Local\node-gyp\Cache\12.14.1\include\node\v8.h(2613,40): message : see declaration of 'v8::Value::Int32Value' (compiling source file ..\src\bufferutil.cc) [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\bufferutil.cc(94,1): error C2660: 'v8::Value::Int32Value': function does not take 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
C:\Users\dummyuser\AppData\Local\node-gyp\Cache\12.14.1\include\node\v8.h(2613,40): message : see declaration of 'v8::Value::Int32Value' (compiling source file ..\src\bufferutil.cc) [C:\Temp\web3.test\node_modules@web3-js\websocket\build\bufferutil.vcxproj]
validation.cc
win_delay_load_hook.cc
C:\Temp\web3.test\node_modules@web3-js\websocket\src\validation.cc(114,1): error C2660: 'v8::FunctionTemplate::GetFunction': function does not take 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\validation.vcxproj]
C:\Users\dummyuser\AppData\Local\node-gyp\Cache\12.14.1\include\node\v8.h(5995,46): message : see declaration of 'v8::FunctionTemplate::GetFunction' (compiling source file ..\src\validation.cc) [C:\Temp\web3.test\node_modules@web3-js\websocket\build\validation.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\validation.cc(114,1): error C2661: 'Nan::Set': no overloaded function takes 2 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\validation.vcxproj]
C:\Temp\web3.test\node_modules@web3-js\websocket\src\validation.cc(133,1): error C2661: 'v8::Value::ToObject': no overloaded function takes 0 arguments [C:\Temp\web3.test\node_modules@web3-js\websocket\build\validation.vcxproj]

Versions

[NPM, Node, Web3.js, OS, device...]
OS: Win 10, desktop
Node: v12.14.1
Npm: 6.13.4

@cgewecke
Copy link
Collaborator

cgewecke commented Feb 11, 2020

@user535353

I see web3 installing successfully in CI on Node 12.13 / Ubuntu Xenial here.

Could you see if your error persists when moving down to a slightly lower Node version? This might help to isolate the problem.

There's also a guide to Window's specific node-gyp problems here that might be useful for debugging. Could you go through that list and see if any of the suggestions resolve this for you?

For clarity - could you also list which version of Web3 you're installing?

@user535353
Copy link
Author

For clarity - could you also list which version of Web3 you're installing?
just 'npm install web3'
package.json after that:
"dependencies": {
"web3": "^1.2.6"
}

@user535353
Copy link
Author

with node v11.15.0:

C:\Temp\web3.test\node_modules\keccak>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Program Files\Python38\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack File "", line 1
gyp ERR! stack import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack at ChildProcess.exithandler (child_process.js:299:12)
gyp ERR! stack at ChildProcess.emit (events.js:193:13)
gyp ERR! stack at maybeClose (internal/child_process.js:999:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:266:5)
gyp ERR! System Windows_NT 10.0.18363
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:\Temp\web3.test\node_modules\keccak
gyp ERR! node -v v11.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! keccak@2.1.0 rebuild: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the keccak@2.1.0 rebuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dummyuser\AppData\Roaming\npm-cache_logs\2020-02-11T18_25_14_927Z-debug.log
"Keccak bindings compilation fail. Pure JS implementation will be used."

secp256k1@3.8.0 install C:\Temp\web3.test\node_modules\secp256k1
npm run rebuild || echo "Secp256k1 bindings compilation fail. Pure JS implementation will be used."

@cgewecke
Copy link
Collaborator

@user535353 Have you looked at the windows guide referenced above? Do you have windows-build-tools installed as advised there?

@user535353
Copy link
Author

user535353 commented Feb 11, 2020

Seems, the websocket is just incompatible with most recent node.
For instance it uses 't->GetFunction()' without a parameter, but the latest version of v8 has the following definition (with a parameter):

/** Returns the unique function instance in the current execution context.*/
V8_WARN_UNUSED_RESULT MaybeLocal GetFunction(
Local context);

So there is a number of errors when trying to build the websocket project:
image

@user535353
Copy link
Author

v8/v8@5234d99

image

@user535353
Copy link
Author

@user535353
Copy link
Author

So, seems, the websocket dependency needs to be updated.

@cgewecke
Copy link
Collaborator

cgewecke commented Feb 11, 2020

@user535353 Thanks for investigating and for those links.

I'm not able to reproduce this failure for Web3 1.2.6 on either 12.14.1 or 12.16.0. Tried:

  • locally, (Mac OSX) Node (npm install --save web3)
  • on Travis (Ubuntu / Xenial) (from git clone ) (see here)

Will see if I can get a Windows job running in CI to discover if this problem is Windows specific.

@user535353
Copy link
Author

@cgewecke Is there any reason to depend on '@web3-js/websocket' instead of 'websocket'?

npm install websocket - gives 1.0.31 and no errors

npm install @web3-js/websocket - gives 1.0.30 and errors

@cgewecke
Copy link
Collaborator

@user535353

npm install websocket - gives 1.0.31 and no errors

Agree this would be the ideal solution. Would also like to be able to reproduce the error.

The origins of the Websocket fork are in:

@nivida
Copy link
Contributor

nivida commented Feb 13, 2020

Great they probably did improve the detection of the global object as well. Can you verify that those changes are applied @cgewecke?

Edit:
We probably have to update our fork and to publish a new version with the node-gyp fix.

@cgewecke
Copy link
Collaborator

@user535353

Out of curiosity - does the installation succeed for you or not?

Was able to reproduce the output you posted above in this Travis CI job (Windows / Node 12.16.0 ), but installation appears to ok there. (Maybe superficially). Npm install exits 0.

Node-gyp isn't throwing a fatal error.

@cgewecke cgewecke changed the title npm install issues - websocket build is failing Update websocket fork (node-gyp err output on Windows / Node 12) Feb 17, 2020
@cgewecke
Copy link
Collaborator

cgewecke commented Feb 17, 2020

@user535353 Have reproduced the error you're seeing in a Windows 10 / Node 12 container on Travis. It only appears in the Windows node-gyp output, Linux and OSX are clean.

Additionally, Web3 installs without obvious problems in the test. NPM completes successfully, and the lib is able to open a Websocket connection to Infura / fetch a block. So this doesn't look critical - e.g Windows / Node 12 users are able to install.

That said we will need to pull in patches from web3-js/websocket's parent fork as part of basic 1.x maintenance and this should be part of it.

@Walker0125
Copy link

same errors (Windows 10/Node 12.13.0). any progress for this issue?

@wbt
Copy link
Contributor

wbt commented May 5, 2020

This issue was fixed in Websocket 1.0.31, but web3's fork did not keep up with that change.

@cgewecke cgewecke added this to To do in v1.2.9 May 8, 2020
@cgewecke cgewecke self-assigned this May 8, 2020
@cgewecke cgewecke moved this from To do to In Review in v1.2.9 May 22, 2020
@cgewecke cgewecke moved this from In Review to Done in v1.2.9 May 22, 2020
@ryanio ryanio mentioned this issue Jun 2, 2020
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues
Projects
No open projects
v1.2.9
  
Done
6 participants
@wbt @nivida @cgewecke @Walker0125 @user535353 and others