I have multiple Angular 2 projects and each of them contains package.json
file. I run npm install
command on those files to install node modules for each of those project. Since each project has a node_modules
folder now, I'd like to have just one node_modules
folder shared among all projects and install additional modules to that folder.
I tried running npm install --prefix ..
command in first project. Here's the result:
-my_projects
--project1
---package.json
--project2
---package.json
--project3
---package.json
--node_modules
---project1
----node_modules
----all_other_project_files_and_folders
--etc
What happened? Yes, node_modules
folder in a parent folder was created as I expected, but in that folder, a copy of my entire project is also included. I just wanted to install all of my project's dependencies in one common folder instead of duplicating those modules' installations in multiple projects.
How can I achieve this? Is a '--prefix' option the right way at all?