Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNode 6.2.2 & node.bcrypt.js #206
Comments
|
Is this specific to v6.2.2? Also, is this something that could be done in your own Docker file that builds on top of the current image? |
|
@chorrell I don't think this is specific to v6.2.2. I'm not for sure how to change the Dockerfile so that it will run the I did mention how when using this Dockerfile you can use the command |
|
Thanks for this, been struggling to find a solution. Was hoping to find a solution where node_modules was not copied from the host to the container. Are there downsides to that approach that I have not considered? |
|
am using the Alpine docker (https://github.com/nodejs/docker-node/blob/3b038b8a1ac8f65e3d368bedb9f979884342fdcb/6.9/alpine/Dockerfile) and faced the same error. So, edited the docker file not to remove the "&& apk del .build-deps " build dependencies but rest all the same. and hence when the npm install was performed, it worked fine. |
When using bcrypt with this image you may run into a problem if you are mounting your local
node_modulesfolder into your docker container. There may be times when you need to recompile C++ addons (which bcrypt has). So, to do this make sure that before your container starts executing code to runnpm rebuildlink.I do this by building my container and then
execing into it. I then manually runnpm rebuildas I haven't found a better way to do this yet.I hope this saves somebody else the hour I wasted trying to figure this out.
Edit
So an easier solution for docker compose is
command: bash -c "npm rebuild && npm start"assumingnpm startkicks off your server. This same method can be applied to a Dockerfile or the command line.Edit2
Another, albeit uglier, solution is to mount the Host machines g++ compiler:
/usr/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/