Node.bcrypt.js: npm install - cannot build bcrypt

Created on 19 Nov 2018  Â·  8Comments  Â·  Source: kelektiv/node.bcrypt.js

Trying to install bcrypt for NodeJS 10.13.0 and receive the errors:

In file included from ../node_modules/nan/nan_new.h:189:0,
                 from ../node_modules/nan/nan.h:222,
                 from ../src/bcrypt_node.cc:1:
../node_modules/nan/nan_implementation_12_inl.h: In static member function 'static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)':
../node_modules/nan/nan_implementation_12_inl.h:340:37: warning: 'static v8::Local<v8::Value> v8::StringObject::New(v8::Local<v8::String>)' is deprecated: Use Isolate* version [-Wdeprecated-declarations]
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:5053:37: note: declared here
                 static Local<Value> New(Local<String> value));
                                     ^
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../src/bcrypt_node.cc:1:0:
../node_modules/nan/nan.h: In constructor 'Nan::Utf8String::Utf8String(v8::Local<v8::Value>)':
../node_modules/nan/nan.h:1066:53: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
       v8::Local<v8::String> string = from->ToString();
                                                     ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
In file included from ../src/bcrypt_node.cc:1:0:
../node_modules/nan/nan.h:1080:74: warning: 'int v8::String::WriteUtf8(char*, int, int*, int) const' is deprecated: Use Isolate* version [-Wdeprecated-declarations]
         length_ = string->WriteUtf8(str_, static_cast<int>(len), 0, flags);
                                                                          ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:2659:21: note: declared here
                 int WriteUtf8(char* buffer, int length = -1,
                     ^
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/bcrypt_node.cc: In function 'char {anonymous}::ToCharVersion(v8::Local<v8::String>)':
../src/bcrypt_node.cc:66:30: warning: 'v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)' is deprecated: Use Isolate version [-Wdeprecated-declarations]
   String::Utf8Value value(str);
                              ^
In file included from /root/.node-gyp/10.13.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/10.13.0/include/node/node.h:63,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:2892:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/root/.node-gyp/10.13.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
../src/bcrypt_node.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE {anonymous}::GenerateSalt(Nan::NAN_METHOD_ARGS_TYPE)':
../src/bcrypt_node.cc:121:60: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     const char minor_ver = ToCharVersion(info[0]->ToString());
                                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE {anonymous}::GenerateSaltSync(Nan::NAN_METHOD_ARGS_TYPE)':
../src/bcrypt_node.cc:150:60: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     const char minor_ver = ToCharVersion(info[0]->ToString());
                                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE {anonymous}::Encrypt(Nan::NAN_METHOD_ARGS_TYPE)':
../src/bcrypt_node.cc:212:44: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String data(info[0]->ToString());
                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc:213:44: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String salt(info[1]->ToString());
                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE {anonymous}::EncryptSync(Nan::NAN_METHOD_ARGS_TYPE)':
../src/bcrypt_node.cc:231:44: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String data(info[0]->ToString());
                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc:232:44: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String salt(info[1]->ToString());
                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE {anonymous}::Compare(Nan::NAN_METHOD_ARGS_TYPE)':
../src/bcrypt_node.cc:312:45: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String input(info[0]->ToString());
                                             ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc:313:49: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String encrypted(info[1]->ToString());
                                                 ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE {anonymous}::CompareSync(Nan::NAN_METHOD_ARGS_TYPE)':
../src/bcrypt_node.cc:331:42: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String pw(info[0]->ToString());
                                          ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc:332:44: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String hash(info[1]->ToString());
                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~
../src/bcrypt_node.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE {anonymous}::GetRounds(Nan::NAN_METHOD_ARGS_TYPE)':
../src/bcrypt_node.cc:352:44: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
     Nan::Utf8String hash(info[0]->ToString());
                                            ^
In file included from /root/.node-gyp/10.13.0/include/node/node.h:63:0,
                 from ../node_modules/nan/nan.h:52,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.13.0/include/node/v8.h:10040:15: note: declared here
 Local<String> Value::ToString() const {
               ^~~~~

for NodeJS 8.12.0 and 9.11.2 - OK

Most helpful comment

I am having the same issue. I am trying to run a docker image.
node:10-alpine
I use "bcrypt": "^3.0.2" in my package.json
In my Dockerfile I added
RUN apk add --no-cache --virtual deps \ python \ build-base \ && npm install --only=production \ && apk del deps
it fails with the same error mentioned by @akaNightmare
but when I change the image to node:8-alpine
it WOKRS!

All 8 comments

For node 10 use bcrypt 3.x. X

@agathver I use "bcrypt": "^3.0.2",

You are trying to install bcrypt as root (or in a sudo environment)
node-gyp doesn't run as root.

Use unsafe permissions with npm

On Mon 19 Nov, 2018, 8:05 PM Ivan <[email protected] wrote:

@agathver https://github.com/agathver "bcrypt": "^3.0.2",

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/kelektiv/node.bcrypt.js/issues/678#issuecomment-439913286,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQCaT7EfzVfke4wu9O88rwN_o6n8BzFNks5uwsHNgaJpZM4YpMkb
.

I am having the same issue. I am trying to run a docker image.
node:10-alpine
I use "bcrypt": "^3.0.2" in my package.json
In my Dockerfile I added
RUN apk add --no-cache --virtual deps \ python \ build-base \ && npm install --only=production \ && apk del deps
it fails with the same error mentioned by @akaNightmare
but when I change the image to node:8-alpine
it WOKRS!

You are trying to install bcrypt as root (or in a sudo environment) node-gyp doesn't run as root. Use unsafe permissions with npm
…
On Mon 19 Nov, 2018, 8:05 PM Ivan @.* wrote: @agathver https://github.com/agathver "bcrypt": "^3.0.2", — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#678 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AQCaT7EfzVfke4wu9O88rwN_o6n8BzFNks5uwsHNgaJpZM4YpMkb .

I use .npmrc and there unsafe-perm=true

+1
the same issue, using:
alpine
node:10.13.0
"bcrypt": "^3.0.2"

Does anyone found a fix ?

On Mac using the same version of Node.js and bcrypt compiles fine.

@raugaral Could you please describe how it will help with the issue?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amjedomar picture amjedomar  Â·  5Comments

japita-se picture japita-se  Â·  4Comments

alanosman picture alanosman  Â·  3Comments

CQzhangshuai picture CQzhangshuai  Â·  5Comments

summertong picture summertong  Â·  5Comments