barrysteyn / node-scrypt

Scrypt for Node
370 stars 88 forks source link

Build error installing on Mac OS X. Problem with scrypt install script? #201

Open sgoendoer opened 4 years ago

sgoendoer commented 4 years ago

Hi, I have a problem with the installation of scrypt.

I installed node via brew on my Mac OS X 10.15.6. Everything runs fine, but I wanted to install web3, which fails due to the dependency of scrypt. So I tried installing scrypt manually via npm. This fails as follows:

~ npm install scrypt

> scrypt@6.0.3 preinstall /Users/me/node_modules/scrypt
> node node-scrypt-preinstall.js

> scrypt@6.0.3 install /Users/me/node_modules/scrypt
> node-gyp rebuild

  SOLINK_MODULE(target) Release/copied_files.node
  CC(target) Release/obj.target/scrypt_wrapper/src/util/memlimit.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/keyderivation.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/pickparams.o
  CC(target) Release/obj.target/scrypt_wrapper/src/scryptwrapper/hash.o
  LIBTOOL-STATIC Release/scrypt_wrapper.a
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/crypto/crypto_scrypt_smix.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/warnp.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/alg/sha256.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/libcperciva/util/insecure_memzero.o
  CC(target) Release/obj.target/scrypt_lib/scrypt/scrypt-1.2.0/lib/scryptenc/scryptenc_cpuperf.o
  LIBTOOL-STATIC Release/scrypt_lib.a
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_async.o
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
In file included from ../src/node-boilerplate/inc/scrypt_params_async.h:28:
In file included from ../src/node-boilerplate/inc/scrypt_async.h:28:
../src/node-boilerplate/inc/scrypt_common.h:39:14: error: no matching member function for call to
      'Get'
      N(obj->Get(Nan::New("N").ToLocalChecked())->Uint32Value()),
        ~~~~~^~~
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3717:43: note: candidate
      function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3720:43: note: candidate
      function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
In file included from ../src/node-boilerplate/inc/scrypt_params_async.h:28:
In file included from ../src/node-boilerplate/inc/scrypt_async.h:28:
../src/node-boilerplate/inc/scrypt_common.h:40:14: error: no matching member function for call to
      'Get'
      r(obj->Get(Nan::New("r").ToLocalChecked())->Uint32Value()),
        ~~~~~^~~
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3717:43: note: candidate
      function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3720:43: note: candidate
      function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
In file included from ../src/node-boilerplate/inc/scrypt_params_async.h:28:
In file included from ../src/node-boilerplate/inc/scrypt_async.h:28:
../src/node-boilerplate/inc/scrypt_common.h:41:14: error: no matching member function for call to
      'Get'
      p(obj->Get(Nan::New("p").ToLocalChecked())->Uint32Value()) {}
        ~~~~~^~~
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3717:43: note: candidate
      function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3720:43: note: candidate
      function not viable: requires 2 arguments, but 1 was provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
                                          ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
In file included from ../src/node-boilerplate/inc/scrypt_params_async.h:28:
../src/node-boilerplate/inc/scrypt_async.h:53:17: warning: 'Call' is deprecated
      [-Wdeprecated-declarations]
      callback->Call(1, argv);
                ^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_params_async.h:35:36: error: too few arguments to function
      call, single argument 'context' was not specified
      maxtime(info[0]->NumberValue()),
              ~~~~~~~~~~~~~~~~~~~~ ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:2861:3: note: 'NumberValue'
      declared here
  V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
  ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8config.h:431:31: note: expanded
      from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_params_async.h:36:39: error: too few arguments to function
      call, single argument 'context' was not specified
      maxmemfrac(info[1]->NumberValue()),
                 ~~~~~~~~~~~~~~~~~~~~ ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:2861:3: note: 'NumberValue'
      declared here
  V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
  ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8config.h:431:31: note: expanded
      from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_params_async.h:37:36: error: too few arguments to function
      call, single argument 'context' was not specified
      maxmem(info[2]->IntegerValue()),
             ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:2863:3: note: 'IntegerValue'
      declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8config.h:431:31: note: expanded
      from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
In file included from ../src/node-boilerplate/scrypt_params_async.cc:4:
../src/node-boilerplate/inc/scrypt_params_async.h:38:39: error: too few arguments to function
      call, single argument 'context' was not specified
      osfreemem(info[3]->IntegerValue())
                ~~~~~~~~~~~~~~~~~~~~~ ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:2863:3: note: 'IntegerValue'
      declared here
  V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue(
  ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8config.h:431:31: note: expanded
      from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
../src/node-boilerplate/scrypt_params_async.cc:23:8: error: no matching member function for call
      to 'Set'
  obj->Set(Nan::New("N").ToLocalChecked(), Nan::New<Integer>(logN));
  ~~~~~^~~
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
../src/node-boilerplate/scrypt_params_async.cc:24:8: error: no matching member function for call
      to 'Set'
  obj->Set(Nan::New("r").ToLocalChecked(), Nan::New<Integer>(r));
  ~~~~~^~~
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
../src/node-boilerplate/scrypt_params_async.cc:25:8: error: no matching member function for call
      to 'Set'
  obj->Set(Nan::New("p").ToLocalChecked(), Nan::New<Integer>(p));
  ~~~~~^~~
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/me/Library/Caches/node-gyp/14.7.0/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
../src/node-boilerplate/scrypt_params_async.cc:32:13: warning: 'Call' is deprecated
      [-Wdeprecated-declarations]
  callback->Call(2, argv);
            ^
../../nan/nan.h:1741:3: note: 'Call' has been explicitly marked deprecated here
  NAN_DEPRECATED inline v8::Local<v8::Value>
  ^
../../nan/nan.h:106:40: note: expanded from macro 'NAN_DEPRECATED'
# define NAN_DEPRECATED __attribute__((deprecated))
                                       ^
2 warnings and 10 errors generated.
make: *** [Release/obj.target/scrypt/src/node-boilerplate/scrypt_params_async.o] Error 1
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:314:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/Cellar/node/14.7.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/me/node_modules/scrypt
gyp ERR! node -v v14.7.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN enoent ENOENT: no such file or directory, open '/Users/me/package.json'
npm WARN me No description
npm WARN me No repository field.
npm WARN me No README data
npm WARN me No license field.

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!     /Users/me/.npm/_logs/2020-08-07T10_53_00_595Z-debug.log

That log referenced in the last line reads:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/Cellar/node/14.7.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'scrypt'
1 verbose cli ]
2 info using npm@6.14.7
3 info using node@v14.7.0
4 verbose config Skipping project config: /Users/me/.npmrc. (matches userconfig)
5 verbose npm-session 97fc45c97c5fe052
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 http fetch GET 304 https://registry.npmjs.org/scrypt 182ms (from cache)
9 silly pacote tag manifest for scrypt@latest fetched in 193ms
10 timing stage:loadCurrentTree Completed in 221ms
11 silly install loadIdealTree
12 silly install cloneCurrentTreeToIdealTree
13 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
14 silly install loadShrinkwrap
15 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
16 silly install loadAllDepsIntoIdealTree
17 silly resolveWithNewModule scrypt@6.0.3 checking installable status
18 http fetch GET 304 https://registry.npmjs.org/nan 52ms (from cache)
19 silly pacote range manifest for nan@^2.0.8 fetched in 53ms
20 silly resolveWithNewModule nan@2.14.1 checking installable status
21 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 59ms
22 timing stage:loadIdealTree Completed in 62ms
23 silly currentTree me
24 silly idealTree me
24 silly idealTree ├── nan@2.14.1
24 silly idealTree └── scrypt@6.0.3
25 silly install generateActionsToTake
26 timing stage:generateActionsToTake Completed in 3ms
27 silly diffTrees action count 2
28 silly diffTrees add nan@2.14.1
29 silly diffTrees add scrypt@6.0.3
30 silly decomposeActions action count 16
31 silly decomposeActions fetch nan@2.14.1
32 silly decomposeActions extract nan@2.14.1
33 silly decomposeActions preinstall nan@2.14.1
34 silly decomposeActions build nan@2.14.1
35 silly decomposeActions install nan@2.14.1
36 silly decomposeActions postinstall nan@2.14.1
37 silly decomposeActions finalize nan@2.14.1
38 silly decomposeActions refresh-package-json nan@2.14.1
39 silly decomposeActions fetch scrypt@6.0.3
40 silly decomposeActions extract scrypt@6.0.3
41 silly decomposeActions preinstall scrypt@6.0.3
42 silly decomposeActions build scrypt@6.0.3
43 silly decomposeActions install scrypt@6.0.3
44 silly decomposeActions postinstall scrypt@6.0.3
45 silly decomposeActions finalize scrypt@6.0.3
46 silly decomposeActions refresh-package-json scrypt@6.0.3
47 silly install executeActions
48 silly doSerial global-install 16
49 verbose correctMkdir /Users/me/.npm/_locks correctMkdir not in flight; initializing
50 verbose lock using /Users/me/.npm/_locks/staging-2a35c0e1d4d48c1f.lock for /Users/me/node_modules/.staging
51 silly doParallel extract 2
52 silly extract nan@2.14.1
53 silly extract scrypt@6.0.3
54 silly tarball trying nan@^2.0.8 by hash: sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==
55 silly tarball trying scrypt@latest by hash: sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=
56 silly extract nan@^2.0.8 extracted to /Users/me/node_modules/.staging/nan-5d058ac4 (56ms)
57 silly extract scrypt@latest extracted to /Users/me/node_modules/.staging/scrypt-db722094 (87ms)
58 timing action:extract Completed in 89ms
59 silly doReverseSerial unbuild 16
60 silly doSerial remove 16
61 silly doSerial move 16
62 silly doSerial finalize 16
63 silly finalize /Users/me/node_modules/nan
64 silly finalize /Users/me/node_modules/scrypt
65 timing action:finalize Completed in 3ms
66 silly doParallel refresh-package-json 2
67 silly refresh-package-json /Users/me/node_modules/nan
68 silly refresh-package-json /Users/me/node_modules/scrypt
69 timing action:refresh-package-json Completed in 15ms
70 silly doParallel preinstall 2
71 silly preinstall nan@2.14.1
72 info lifecycle nan@2.14.1~preinstall: nan@2.14.1
73 silly preinstall scrypt@6.0.3
74 info lifecycle scrypt@6.0.3~preinstall: scrypt@6.0.3
75 verbose lifecycle scrypt@6.0.3~preinstall: unsafe-perm in lifecycle true
76 verbose lifecycle scrypt@6.0.3~preinstall: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/me/node_modules/scrypt/node_modules/.bin:/Users/me/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin
77 verbose lifecycle scrypt@6.0.3~preinstall: CWD: /Users/me/node_modules/scrypt
78 silly lifecycle scrypt@6.0.3~preinstall: Args: [ '-c', 'node node-scrypt-preinstall.js' ]
79 timing audit submit Completed in 822ms
80 http fetch POST 200 https://registry.npmjs.org/-/npm/v1/security/audits/quick 822ms
81 timing audit body Completed in 0ms
82 silly lifecycle scrypt@6.0.3~preinstall: Returned: code: 0  signal: null
83 timing action:preinstall Completed in 4247ms
84 silly doSerial build 16
85 silly build nan@2.14.1
86 info linkStuff nan@2.14.1
87 silly linkStuff nan@2.14.1 has /Users/me/node_modules as its parent node_modules
88 silly build scrypt@6.0.3
89 info linkStuff scrypt@6.0.3
90 silly linkStuff scrypt@6.0.3 has /Users/me/node_modules as its parent node_modules
91 timing action:build Completed in 1ms
92 silly doSerial global-link 16
93 silly doParallel update-linked 0
94 silly doSerial install 16
95 silly install nan@2.14.1
96 info lifecycle nan@2.14.1~install: nan@2.14.1
97 silly install scrypt@6.0.3
98 info lifecycle scrypt@6.0.3~install: scrypt@6.0.3
99 verbose lifecycle scrypt@6.0.3~install: unsafe-perm in lifecycle true
100 verbose lifecycle scrypt@6.0.3~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/me/node_modules/scrypt/node_modules/.bin:/Users/me/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Apple/usr/bin
101 verbose lifecycle scrypt@6.0.3~install: CWD: /Users/me/node_modules/scrypt
102 silly lifecycle scrypt@6.0.3~install: Args: [ '-c', 'node-gyp rebuild' ]
103 silly lifecycle scrypt@6.0.3~install: Returned: code: 1  signal: null
104 info lifecycle scrypt@6.0.3~install: Failed to exec install script
105 timing action:install Completed in 4939ms
106 verbose unlock done using /Users/men/.npm/_locks/staging-2a35c0e1d4d48c1f.lock for /Users/me/node_modules/.staging
107 timing stage:rollbackFailedOptional Completed in 39ms
108 timing stage:runTopLevelLifecycles Completed in 9637ms
109 silly saveTree me
109 silly saveTree └─┬ scrypt@6.0.3
109 silly saveTree   └── nan@2.14.1
110 warn enoent ENOENT: no such file or directory, open '/Users/me/package.json'
111 verbose enoent This is related to npm not being able to find a file.
112 warn me No description
113 warn me No repository field.
114 warn me No README data
115 warn me No license field.
116 verbose stack Error: scrypt@6.0.3 install: `node-gyp rebuild`
116 verbose stack Exit status 1
116 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
116 verbose stack     at EventEmitter.emit (events.js:314:20)
116 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
116 verbose stack     at ChildProcess.emit (events.js:314:20)
116 verbose stack     at maybeClose (internal/child_process.js:1051:16)
116 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
117 verbose pkgid scrypt@6.0.3
118 verbose cwd /Users/me
119 verbose Darwin 19.6.0
120 verbose argv "/usr/local/Cellar/node/14.7.0/bin/node" "/usr/local/bin/npm" "install" "scrypt"
121 verbose node v14.7.0
122 verbose npm  v6.14.7
123 error code ELIFECYCLE
124 error errno 1
125 error scrypt@6.0.3 install: `node-gyp rebuild`
125 error Exit status 1
126 error Failed at the scrypt@6.0.3 install script.
126 error This is probably not a problem with npm. There is likely additional logging output above.
127 verbose exit [ 1, true ]

I asked the topic already some time ago on stack overflow here: https://stackoverflow.com/questions/63015458/npm-install-errors-for-package-scrypt, yet no solution was found. I tried reinstalling everything, switching permissions of files and directories.

My env is: Mac OS X 10.15.6 node 14.7.0 npm 6.14.7 node-gyp 7.0.0

thaarok commented 3 years ago

There is already fix in master branch, however new version was not released yet. You can try to use fixed version from git:

npm install github:barrysteyn/node-scrypt#fb60a8d3c158fe115a624b5ffa7480f3a24b03fb

However, if this is your direct dependecy, consider following warning in README:

WARNING!!! This module is deprecated. Instead, use https://nodejs.org/api/crypto.html#crypto_crypto_scrypt_password_salt_keylen_options_callback

We are waiting for the new version release from May 2020 in vain: https://github.com/barrysteyn/node-scrypt/pull/197#issuecomment-630954048

skykingit commented 3 years ago

Mac Catalina ,Same error ,anyone fix this?