Docker, AlpineLinux and Ubuntu – why does `node_modules` different



I do use CI/CD of gitlab to bundle my application.
I do use node:14-alpine as image and do run yarn to build my app.

After build is finished, I do deploy my app via rsync to the target-server, which run’s ubuntu 20.04.

On this server, I do use pm2 to start the app and keep it running.


If I look into the logs, I do see an error like this:
enter image description here

I’ve searched a bit, and found that the issue might be caused of musl-dev is missing.
I’ve installed it at my server, and into the docker-container, but with same result.

BUT, if I do delete the node_modules directory from server, and run yarn install right at the Server, the app run like expected


So why does this issue happens here? Must I have the same distribution & version of linux in my docker-container to fit all dependencies?

Source: Docker Questions

Categorised as docker, gitlab, node-modules, node.js, pm2 Tagged , , , ,


Leave a Reply

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us