Description
When using bcrypt with this image you may run into a problem if you are mounting your local node_modules
folder 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 run npm rebuild
link.
I do this by building my container and then exec
ing into it. I then manually run npm rebuild
as 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"
assuming npm start
kicks 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/