Can't npm install bcrypt in my docker image
I am trying to run my application Sails.js
using a standard node
Docker image , but the build fails when it tries npm install bcrypt
.
> bcrypt@0.8.0 install /myapp/node_modules/bcrypt
> node-gyp rebuild
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: node-v0.10.33.tar.gz local checksum 822ba41f2d77b704ab63e244dfef7431b31893c19bfe3bf228c06b6aff063ed5 not match remote 75dc26c33144e6d0dc91cb0d68aaf0570ed0a7e4b0c35f3a7a726b500edd081e
gyp ERR! stack at deref (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:299:20)
gyp ERR! stack at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:340:13)
gyp ERR! stack at IncomingMessage.emit (events.js:117:20)
gyp ERR! stack at _stream_readable.js:943:16
gyp ERR! stack at process._tickCallback (node.js:419:13)
gyp ERR! System Linux 3.16.1-tinycore64
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /pos/node_modules/bcrypt
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v1.0.2
gyp ERR! not ok
Alternatively, sometimes it just fails like this:
> bcrypt@0.8.0 install /myapp/node_modules/bcrypt
> node-gyp rebuild
Killed
And sometimes it just hangs endlessly on
> bcrypt@0.8.0 install /pos/node_modules/bcrypt
> node-gyp rebuild
Mine Dockerfile
looks like this:
FROM node:0.10.33
# copy the source files into the image
ADD . /myapp
# Define working directory.
WORKDIR /myapp
# Install node-gyp as global and ensure it all clean and tide
RUN npm install -g node-gyp && \
node-gyp clean && \
npm cache clean
# Install project dependencies
RUN npm install
# Expose sails port (still in development mind you)
EXPOSE 1337
# Define default command.
CMD ["node app"]
Things i have tried
- this post on another Stackoverflow thread suggested to me as well
RUN apt-get -y install g++
, but adding that mineDockerfile
is irrelevant and it just reports thatg++ is already the newest version.
- this post suggested that I make sure it is
openssl
installed, so I addedRUN apt-get install -y openssl
that also reportedopenssl is already the newest version
. - I also tried
RUN apt-get install -y build-essential
, but this also reports that this is already the latest version.
I've seen suggestions that Node should be installed as a version legacy
, which should be answered by the default Node image if needed, I believe, so I also reported this as a problem with the docker-library / node project .
In the meantime, what else should I try?
source to share
Thanks to everyone whose advice in the comments and answers led me to my conclusion.
The problem was either some damage in my installation docker
or some kind of incompatibility between dvm
and fig
, but I solved this problem as follows
dvm down brew remove fig brew remove dvm brew remove docker brew cleanup --force -s rm -rf ~/VirtualBox VMs/boot2docker-vm brew install docker brew install boot2docker boot2docker init boot2docker up echo export DOCKER_TLS_VERIFY=1 > ~/.bash_profile echo export DOCKER_CERT_PATH=~/.boot2docker/certs/boot2docker-vm > ~/.bash_profile echo export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 > ~/.bash_profile export DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 brew install fig fig build web
and voila - it worked.
The trick really seemed to be that I had a few conflicting bits of crud in my original boot2docker-vm
as it was installed initially through the installer and then through homebrew
and boot2docker
ran into somehow dvm
, wiping everything back to bare metal and rebuilding from scratch, it all worked fine ...
source to share