Home > database >  npm install loom-truffle-provider fails with incompatibility of node-gyp vs scrypt
npm install loom-truffle-provider fails with incompatibility of node-gyp vs scrypt

Time:11-15

I am having no end of trouble installing loom-truffle-provider.

node = v14.18.1 npm = 6.14.15 Linux Ubuntu 20.04

I can try installing locally or globally. Both fail with below error:

~$ npm install -g loom-truffle-provider

make: Leaving directory '/home/joe/.npm-global/lib/node_modules/loom-truffle-provider/node_modules/scrypt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:400:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:282:12)
gyp ERR! System Linux 5.11.0-40-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/joe/.npm-global/lib/node_modules/loom-truffle-provider/node_modules/scrypt
gyp ERR! node -v v14.18.1
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! scrypt@6.0.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the scrypt@6.0.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/joe/.npm/_logs/2021-11-12T22_49_07_516Z-debug.log

but looking up further up the messages, I see lines like these:

/home/joe/.cache/node-gyp/14.18.1/include/node/v8.h:3673:37: note:   candidate expects 3 arguments, 2 provided
../src/node-boilerplate/scrypt_params_async.cc:25:64: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’
   25 |   obj->Set(Nan::New("p").ToLocalChecked(), Nan::New<Integer>(p));
      |                                                                ^

There are about 9 of these errors, all from node-gyp tring to talk to scrypt.

I poked around for all occurance of node-gyp. For example, ~/.cache has:

joe@joeslinux:~/.cache/node-gyp
$ ls -al
total 24
drwxrwxr-x  6 joe joe 4096 Oct 25 19:24 .
drwxr-xr-x 37 joe joe 4096 Oct 27 19:21 ..
drwxrwxr-x  3 joe joe 4096 Aug 24 11:37 10.19.0
drwxrwxr-x  3 joe joe 4096 Oct 25 19:24 14.18.1
drwxrwxr-x  3 joe joe 4096 Sep  4 09:45 16.8.0
drwxrwxr-x  3 joe joe 4096 Sep 19 12:43 16.9.1

I cleared out everything in ~/.cache/node-gyp and reran ~/.cache/node-gyp still getting same error, but now ~/.cache/node-gyp$ is

joe@joeslinux:~/.cache/node-gyp$ ls -al
total 12
drwxrwxr-x  3 joe joe 4096 Nov 12 17:49 .
drwxr-xr-x 37 joe joe 4096 Oct 27 19:21 ..
drwxrwxr-x  3 joe joe 4096 Nov 12 17:49 14.18.1

Therefore, this gets rebuilt by the npm install I have node-gyp all over the place at different versions. Some return a version number. Other's fail.

~/.npm-global/bin/node-gyp --version
v8.4.0

usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp --version
internal/modules/cjs/loader.js:905
  throw err;
  ^

/usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp --version
v5.1.0


/usr/local/n/versions/node/14.18.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp --version
internal/modules/cjs/loader.js:905
  throw err;
  ^

/usr/local/n/versions/node/14.18.1/lib/node_modules/npm/bin/node-gyp-bin/node-gyp --version
v5.1.0

/usr/bin/node-gyp --version
internal/modules/cjs/loader.js:905
  throw err;
  ^

/usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin/node-gyp --version
'internal/modules/cjs/loader.js:905
  throw err;
  ^

I am at a loss how to proceed. I know from reading other threads that node-gyp has this known issue. I tried several workarounds and do not work for me. The error lines state that npm uses node-gyp v5.1.0. How do I get it to try v8.4.0?

I tried the advice in these:

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

NPM modules won't install globally without sudo

https://ethereum.stackexchange.com/questions/86783/linux-node-gyp-installation-woes-in-scrypt-package

All these posting ought to have solved the issue on my particular computer, but no joy so far. One suggests reverting to a prior version of node. That posts refers to reverting back from node 12.16.1 to a node 11. But I am already on 14.8.1. I don't think it's wise for me to go all the way back from 14 to 11 based on a year-old post. Other posts mention that "something is incompatible." Okay, I think I found at least the first thing incompatible. How would I fix it? Sorry, still on steep part of Linux learning curve. Any node-gyp people or scrypt people following these posts?

The complete log is at https://github.com/molnarjoe/myGitRepository/blob/master/2021-11-12T22_49_07_516Z-debug.log

CodePudding user response:

The scrypt package is deprecated, and won't be compatible with node v14.

You can try upgrading loom-truffle-provider to 0.15.0 or 0.16.0.

Check out https://github.com/loomnetwork/loom-truffle-provider/issues/12#issuecomment-853959947

  • Related