I am working on multiple Angular project at same time. Each time when I check out the code I need to put node modules there, which takes around 20 minutes of time.
Is there any way, we can keep node module at one location at my PC say as "D:/my_node_modules/{node_module}"
and use this location's node module in my new projects say as my project is present at location "E:/Svn_Project/my_angular_project"
?

- 1,642
- 5
- 20
- 30

- 57
- 1
- 9
-
Not sure what you mean exactly. Did you store node_modules into your VCS (which seems to be SVN)? If so, then don't. If not, Yarn uses a local cache, and AFAIR, npm also does now. And of course there's no reason for you to delete your node_modules folders in the first place. 20 minutes is a lot of times. Are you working on a pre-ADSL network connection? – JB Nizet Jan 03 '19 at 08:41
-
It is highly not recommended to store node_modules in any kind of file history system, svn, git solution! Read here: https://stackoverflow.com/a/18129049/4628787 It is better to share the package.json and package.lock because there are all relevant information for your packages. And if you use some CI tools npm could automatically install them on pull/receive – muuvmuuv Jan 03 '19 at 09:10
-
@muuvmuuv In SVN, I have my project code without node_modules. node_modules is already downloaded at my local. Now when i do checkout from SVN instead of doing npm install I want to use my node_module folder which has been already kept at my local to avoid downloading time. Is it possible? – saurabh gupta Jan 06 '19 at 19:53
2 Answers
If you are using SVN checkout the code, you should not store node_modules on your repository. Excluded it.
If you mean, when you check out the code, the node_modules folder is empty. And then you have to run
npm install
like 20 minutes. So I think the problem is your node version. If you upgrade your node to latest version. It will cache your package. So you only wait npm install for first time. Next time, node_modules will be taken from cache, so you only need to wait around 30 seconds.

- 24
- 1
-
In SVN, I have my project code without node_modules. node_modules is already downloaded at my local. Now when i do checkout from SVN instead of doing npm install I want to use my node_module folder which has been already kept at my local to avoid downloading time. Is it possible? – saurabh gupta Jan 06 '19 at 19:55
This is only a problem when you have limited internet access with low internet speed.
But anyway you can use Yarn instead of NPM: "when you install a package using Yarn (using yarn add packagename), it places the package on your disk. During the next install, this package will be used instead of sending an HTTP request to get the tarball from the registry."
Check Yarn here

- 5,188
- 7
- 37
- 61
-
I am working in client network and not allowed to download external software. Is it possible to achieve same with any other strategy? – saurabh gupta Jan 06 '19 at 19:57
-
Yarn is a good solution which you can download once and use more times – Mohammad Kermani Jan 07 '19 at 15:02