Recently I started with Angular 2 app development and I came across some problem. I have multiple projects that use certain node modules and I installed those modules with npm install
in project folder. But then I started thinking: If I have a lot of projects and install node modules for each of those projects, it requires quite a lot of disk space and there are some node modules installed multiple times (in a multiple projects). So I tried to find a way to install node modules in some common folder in order to make that folder some kind of library that my projects use. But there's another problem that comes to my mind: What if different projects require different versions of the same module? How can I install multiple module versions in the same folder?
Maybe I'm thinking completely the wrong way, so I'm asking for your solutions of my problem. Is there any common way of handling node modules in development stage? Does each project have own node modules folder or is there some common folder to ? What's the most common approach (if there is one)?
Thanks!
EDIT: Found this page in Nexus Repository docs - it says that proxying npm registry is "to reduce duplicate downloads", which I'm trying to do. I already managed to create some proxy npm repository and I specified my proxy url in a .npmrc file. When I run npm install
, assets and components are added in my proxy repository but that doesn't solve my problem - node modules are also installed in my project's folder. I don't quite understand how "to reduce duplicate downloads" using Nexus Repository. Can anybody explain to me how to achieve that?