Node.bcrypt.js: node:alpine binaries not found and build fails too

Created on 7 Jun 2018  路  12Comments  路  Source: kelektiv/node.bcrypt.js

Hey guys, sorry to add another one to the list,
Here's the log

> [email protected] install /node_modules/bcrypt
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v2.0.1/bcrypt_lib-v2.0.1-node-v64-linux-x64-musl.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, musl) (falling back to source compile with node-gyp) 
make: Entering directory '/node_modules/bcrypt/build'
  CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
  CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
../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.4.0/include/node/v8.h:26:0,
                 from /root/.node-gyp/10.4.0/include/node/node.h:63,
                 from ../../nan/nan.h:51,
                 from ../src/bcrypt_node.cc:1:
/root/.node-gyp/10.4.0/include/node/v8.h:2846:28: note: declared here
                   explicit Utf8Value(Local<v8::Value> obj));
                            ^
/root/.node-gyp/10.4.0/include/node/v8config.h:324:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node
  COPY Release/bcrypt_lib.node
  COPY /node_modules/bcrypt/lib/binding/bcrypt_lib.node
  TOUCH Release/obj.target/action_after_build.stamp
make: Leaving directory '/node_modules/bcrypt/build'

A sample Dockerfile that fails is

FROM node:alpine

RUN apk --no-cache --virtual deps add \
  python \
  make \
  g++ \
  && npm install --save [email protected] \
  && apk del deps

Most helpful comment

Hey guys, sorry on my part for starting and being late on this thread
so here is a sample to show that bcrypt@latest i.e v3.0.0 works on node-alpine
https://github.com/Aukhan/bcrypt-alpine-test
tested the same with v2.0.0 and seems to be working flawlessly

thanks @agathver and everyone for helping out with this

All 12 comments

Your log says build succeeded.

_Pre-built binaries are provided on a best-effort basis._ Alpine binaries are not provided.

However, you are welcome to contribute to adding a CI pipeline to build them

the container builds but bcrypt module doesn't exist in node_modules
just read up on #528 and others and understand that musl binaries aren't available

adding npm rebuild bcrypt --build-from-source doesn't solve the problem

However, you are welcome to contribute to adding a CI pipeline to build them

Wish I could do that !

Im not familiar with C but what about that parsing or casting error in my logs above where the build fails ?

One more thing I've observed is that if I don't lose the deps by apk del deps
then later I can go into the container shell and run npm install and it will rebuild bcrypt correctly, but not during container setup

@Aukhan ,

This line : make: Leaving directory '/node_modules/bcrypt/build'
Says bcrypt is built correctly. I'll test your Dockerfile in the morning.

Other common reasons for errors:

  1. Running npm install as root.
  2. Missing compilers.

However, it appears that these are not true in your case. Let me check!

Are you sure this fails? It shows a lot of warnings, but it builds!
docker-build.log

While my recommendation is to use build-base and package for alpine
https://github.com/kelektiv/node.bcrypt.js/wiki/Installation-Instructions#docker

yea that's what I said above @agathver that the container builds but node_modules does not contain the bcrypt folder/module hence require('bcrypt') errors out.
I'm gonna try with build-base and let you know if that works.
Thanks for your time !

download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v2.0.1/bcrypt_lib-v2.0.1-node-v64-linux-x64-musl.tar.gz

this link is broken like a https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.3/bcrypt_lib-v1.0.3-node-v64-linux-x64.tar.gz

Installing build-base and adding npm rebuild bcrypt --build-from-source worked for me

@MUCHZER i have added the same but it's not working for me.
After npm install
++++++++ dockerfile

RUN apk add builds-deps
RUN npm rebuild bcrypt --build-from-source

++++++++

Error: -

node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v2.0.1/bcrypt_lib-v2.0.1-node-v64-linux-x64-musl.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, musl) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

@micemuni Python 2.x is required (See Dependencies)

@MUCHZER thanks, it's working

Hey guys, sorry on my part for starting and being late on this thread
so here is a sample to show that bcrypt@latest i.e v3.0.0 works on node-alpine
https://github.com/Aukhan/bcrypt-alpine-test
tested the same with v2.0.0 and seems to be working flawlessly

thanks @agathver and everyone for helping out with this

Was this page helpful?
0 / 5 - 0 ratings