How do I handle the `node_modules` directory when cloud storage?
Since the node_modules folder is being created with the npm install
command, you could exclude the folder entirely when uploading to your Google Drive folder.
When fetching the files from the other computer, simply run the command again to install all the dependencies in the node_modules folder.
Its is really a bad setup. It is advisable to use Version control system to handle source code.
Few Version control system are,
- Github Free & Open source VCS, options for everyone to have access to view & clone your source code in your repository, or to have private repositories
- Bitbucked Private repositories only
While publishing code in VCS / Drive / Dropbox dont include node_modules
folder. All the modules will be reinstalled using npm install
. But make sure that all your neccessary modules were included in package.json dependencies.
For an example, User A adding source in VCS/Drive/Dropbox without node_modules. Once User B get access to download the source. He will download and execute the command npm install. Once all the module installed node_modules folder will be created automatically in User B machine.