DEV Community

Discussion on: The node_modules problem

Collapse
 
besworks profile image
Besworks

The memes in this article were great 👍

As for a solution, it's containerization with docker. If you always build your apps into docker containers you never have loose node_modules folders cluttering up your filesystem. When it comes time to move your data, you're only moving your own source code and (optionally) any composed docker images you've built.

As an added bonus, your entire runtime environment gets shipped so your app can be spun up on any server with all your dependencies available regardless of the host OS's globally installed libraries. Personally, I use node:lts-alpine as my base image which weighs in at < 40mb.