★ wanayoo — archive 1999 https://github.com/nodejs/docker-node/issues/206Nouvelle recherche | Portail wanayoo
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node 6.2.2 & node.bcrypt.js #206

Open
adam-beck opened this issue Jun 26, 2016 · 4 comments
Open

Node 6.2.2 & node.bcrypt.js #206

adam-beck opened this issue Jun 26, 2016 · 4 comments
Labels

Comments

@adam-beck
Copy link

@adam-beck adam-beck commented Jun 26, 2016

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 execing 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/

@chorrell
Copy link
Contributor

@chorrell chorrell commented Jun 28, 2016

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?

@adam-beck
Copy link
Author

@adam-beck adam-beck commented Jun 28, 2016

@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 npm rebuild command at the correct time (because the directory is a mounted volume). I tried modifiying this one and ran RUN npm rebuild right before the CMD [ "node" ]. That doesn't work.

I did mention how when using this Dockerfile you can use the command bash -c "npm rebuild && npm start". This issue was more or less created for documentation.

@chorrell chorrell added the docs label Jun 28, 2016
@djskinner-sky
Copy link

@djskinner-sky djskinner-sky commented Dec 12, 2016

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?

@rasekar2000
Copy link

@rasekar2000 rasekar2000 commented Feb 12, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.