Navigate to the folder where you would like to store node_modules. In this example I will use the %userprofile% shortcut.
I am building an Angular app. So in another temp directory I created a dummy app and copied it's package.json
and its node_modules
folder into my User Profile directory.
Create a cmd file that contains the following.
mklink "./node_modules" "%userprofile%/node_modules"
Now you can run that command anywhere you need those node_modules.
If you have apps with different dependencies you can always create a folder for each version.
mklink "./node_modules" "%userprofile%/angular/node_modules"
or
mklink "./node_modules" "%userprofile%/react/node_modules"
This approach is really buggy!