I have an Angular2 project and I want to move my node_modules folder to a different location.
Say for example my project is in C:\Users\Me\MyAngularProject and i want my modules to be in C:\node_modules (not the global one by the way).
Where can I set this path in the configuration files of my project ?
Unfortunately there is no simple configuration setting. Having node_modules outside the current project is considered bad practice. Although there is a number of use cases for it.
You can use a juncture on Windows
mklink /j node_modules C:\node_modules
or a symlink on Linux
ln -s ~/shared_node_modules node_modules
After you have done this, you need to add --preserve-symlinks
to ng build
and ng serve
in order to prevent typescript warnings and include style sheets.
There is a feature request to add --preserve-symlinks
to ng test
. It seems to work without but there is a huge number of annoying warnings at the moment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With