3

I'm trying to get my Sails.js app up and running using the standard node Docker image but the build is failing when it tries to 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 simply fails as follows:

> bcrypt@0.8.0 install /myapp/node_modules/bcrypt
> node-gyp rebuild

Killed

And sometimes it just hangs indefinitely at

> bcrypt@0.8.0 install /pos/node_modules/bcrypt
> node-gyp rebuild

My Dockerfile looks like:

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's 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've tried

  • this post in another Stackoverflow thread suggested I should also RUN apt-get -y install g++ but adding that to my Dockerfile made no difference and it just reports that g++ is already the newest version.
  • this post suggested I ensure openssl is installed so I added RUN apt-get install -y openssl that that also reported openssl is already the newest version.
  • I've also tried RUN apt-get install -y build-essential but that too reports that it's already the latest version.

I've seen suggestions that Node needs to be installed as a legacy version, which is something the standard Node image ought to be responsible for, if necessary I believe, so I've also reported this as an issue with the docker-library/node project.

In the meantime, what else ought I try?

Community
  • 1
  • 1
Dave Sag
  • 13,266
  • 14
  • 86
  • 134
  • The core of your issue is the `node-v0.10.33.tar.gz local checksum ... not match remote ...` error. The correct SHA is pulled from https://nodejs.org/dist/v0.10.33/SHASUMS256.txt, so something is causing your downloaded `.tar.gz` to be corrupted. Maybe try to download the tar from https://nodejs.org/dist/v0.10.33/ manually and calculate the sha256 and see if it matches then, to at least localize the problem. – loganfsmyth Nov 23 '14 at 02:56
  • Are you behind any proxy or firewall ? – swapnesh Nov 23 '14 at 16:58
  • It looks like node has been updated to 0.10.33_1 this morning so I'll see if that helps. No - not behind a proxy or firewall – Dave Sag Nov 23 '14 at 20:16
  • 1
    I'm trying your `Dockerfile` with a simple `package.json` that has `bcrypt` 0.8.0 as a dependency and it builds just fine. My Docker node image ID is `387247331d9c`. Can you confirm your Docker image base ID and maybe supply a `package.json`? – Andy Shinn Nov 24 '14 at 01:56

1 Answers1

0

Thanks to everyone whose advice in the comments and answers steered me to my conclusion.

The issue was either some sort of corruption within my docker install, or some sort 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 couple of conflicting bits of crud in my original boot2docker-vm from having it installed originally via the installer and then later by homebrew and boot2docker colliding somehow with dvm. By wiping it all back to bare metal and rebuilding from scratch it all worked nicely.

Dave Sag
  • 13,266
  • 14
  • 86
  • 134