barrysteyn / node-scrypt

Scrypt for Node
370 stars 88 forks source link

install error in node alpine v10.2 (but OK with v10.1) #175

Open sulliwane opened 6 years ago

sulliwane commented 6 years ago

Dockerfile:

FROM node:10.2-alpine

RUN mkdir -p /app
WORKDIR /app

RUN apk update && apk upgrade && \
    apk add --no-cache bash git openssh python2 python2-dev py-setuptools dumb-init musl linux-headers build-base ca-certificates

COPY package.json package.json
RUN npm install

COPY . .

CMD ["npm", "start"]

it fails with error:

  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o
In file included from ../../nan/nan.h:51:0,
                 from ../src/node-boilerplate/scrypt_common.cc:28:
/root/.node-gyp/10.2.0/include/node/node.h:53:50: fatal error: core.h: No such file or directory
 #include "core.h"  // NOLINT(build/include_order)
                                                  ^
compilation terminated.
make: *** [scrypt.target.mk:115: Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o] Error 1
make: Leaving directory '/app/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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.15.0-20-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 /app/node_modules/scrypt
gyp ERR! node -v v10.2.0
gyp ERR! node-gyp -v v3.6.2
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!     /root/.npm/_logs/2018-05-25T16_50_24_500Z-debug.log

But It works with node alpine v10.1!

ml1nk commented 6 years ago

Just out of interest, does it work with a current Node version again?

core.h not found #20921

camlegleiter commented 6 years ago

If I attempt to use the latest 10.2-alpine version (which should include the fix in nodejs/node#20921), I get compilation errors due to V8/nan.js API changes. In particular:

error /usr/src/app/node_modules/scrypt: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /usr/src/app/node_modules/scrypt
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@3.6.2
gyp info using node@10.2.1 | linux | x64
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/src/app/node_modules/scrypt/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/10.2.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/10.2.1',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/10.2.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/usr/src/app/node_modules/scrypt',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory '/usr/src/app/node_modules/scrypt/build'
  SOLINK_MODULE(target) Release/obj.target/copied_files.node
  COPY 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
  AR(target) Release/obj.target/scrypt_wrapper.a
  COPY 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
  AR(target) Release/obj.target/scrypt_lib.a
  COPY Release/scrypt_lib.a
  CXX(target) Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o
In file included from ../../nan/nan.h:192:0,
                 from ../src/node-boilerplate/scrypt_common.cc:28:
../../nan/nan_maybe_43_inl.h: In function 'Nan::Maybe<bool> Nan::ForceSet(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<v8::Value>, v8::PropertyAttribute)':
../../nan/nan_maybe_43_inl.h:112:15: error: 'class v8::Object' has no member named 'ForceSet'
   return obj->ForceSet(isolate->GetCurrentContext(), key, value, attribs);
               ^~~~~~~~
In file included from ../src/node-boilerplate/scrypt_common.cc:28:0:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)':
../../nan/nan.h:835:60: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, func, argc, argv);
                                                            ^
In file included from ../../nan/nan.h:49:0,
                 from ../src/node-boilerplate/scrypt_common.cc:28:
/root/.node-gyp/10.2.1/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/node-boilerplate/scrypt_common.cc:28:0:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)':
../../nan/nan.h:850:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::String>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, symbol, argc, argv);
                                                              ^
In file included from ../../nan/nan.h:49:0,
                 from ../src/node-boilerplate/scrypt_common.cc:28:
/root/.node-gyp/10.2.1/include/node/node.h:165:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/node-boilerplate/scrypt_common.cc:28:0:
../../nan/nan.h: In function 'v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)':
../../nan/nan.h:865:62: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, const char*, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
         v8::Isolate::GetCurrent(), target, method, argc, argv);
                                                              ^
In file included from ../../nan/nan.h:49:0,
                 from ../src/node-boilerplate/scrypt_common.cc:28:
/root/.node-gyp/10.2.1/include/node/node.h:158:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
In file included from ../src/node-boilerplate/scrypt_common.cc:28:0:
../../nan/nan.h: In member function 'v8::Local<v8::Value> Nan::Callback::Call_(v8::Isolate*, v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const':
../../nan/nan.h:1479:5: warning: 'v8::Local<v8::Value> node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)' is deprecated: Use MakeCallback(..., async_context) [-Wdeprecated-declarations]
     ));
     ^
In file included from ../../nan/nan.h:49:0,
                 from ../src/node-boilerplate/scrypt_common.cc:28:
/root/.node-gyp/10.2.1/include/node/node.h:172:50: note: declared here
                 NODE_EXTERN v8::Local<v8::Value> MakeCallback(
                                                  ^
/root/.node-gyp/10.2.1/include/node/node.h:88:42: note: in definition of macro 'NODE_DEPRECATED'
     __attribute__((deprecated(message))) declarator
                                          ^~~~~~~~~~
make: *** [scrypt.target.mk:115: Release/obj.target/scrypt/src/node-boilerplate/scrypt_common.o] Error 1
make: Leaving directory '/usr/src/app/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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
gyp ERR! System Linux 4.15.0-24-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 /usr/src/app/node_modules/scrypt

Version Info:

bash-4.4# node -v
v10.2.1
bash-4.4# npm -v
5.6.0
bash-4.4# node-gyp -v
v3.7.0
bash-4.4# gcc --version
gcc (Alpine 6.4.0) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-4.4# g++ --version
g++ (Alpine 6.4.0) 6.4.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.