Is there a way to move node_modules folder to common location ex: C:\angular2 and access in different apps ex: C:\angular2\angular2-quickstart, C:\angular2\angular2-tour-of-heroes etc..
Only for learning angular2, I am creating applications. node_module folder is about 80mb. So instead of every time copy and pasting is there a way to place it in common location.
Here is what you can do.
I have node_modules directory stored in C:\common folder
On windows:
Go to your project folder
mklink /j node_modules C:\common\node_modules
ng serve --preserve-symlinks
On Linux:
ln -s ~/common/node_modules node_modules
One way to do it is to go to the common module C:\angular2|common (the directory where the package.json is), and then do:
npm link
And then from the directory where you want to consume the module (for example C:\angular2\angular2-tour-of-heroes) do:
npm link your-common-module-package-name
This effective creates a file system link between the module using the the common module, and the common module. Have a look here for some documentation about the npm link feature.
Another possibility besides npm link
is to add the common folder to the NODE_PATH
environment variable (check here some docs).