Arrgghhhh! Elephanting Angular, npm and the great vanishing diskspace issue
-
So, I do a lot of Angular development. I help out with a number of projects, all of which have their own npm dependencies. My typical workflow with a new project is to git clone the repo, run npm i to install the dependencies and go off and have a cup of tea while npm downloads all the dependencies. Now, there are ways that you can download a single npm dependency to a centrally managed folder, which will create a symlink for you locally, but as far as I can see, there's no way to tell something like Angular to do this with every package so my diskspace gets eaten up by 100s of Mb of duplicated packages on every install.
-
So, I do a lot of Angular development. I help out with a number of projects, all of which have their own npm dependencies. My typical workflow with a new project is to git clone the repo, run npm i to install the dependencies and go off and have a cup of tea while npm downloads all the dependencies. Now, there are ways that you can download a single npm dependency to a centrally managed folder, which will create a symlink for you locally, but as far as I can see, there's no way to tell something like Angular to do this with every package so my diskspace gets eaten up by 100s of Mb of duplicated packages on every install.
There's probably an NPM package for that... :sigh:
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens
-
So, I do a lot of Angular development. I help out with a number of projects, all of which have their own npm dependencies. My typical workflow with a new project is to git clone the repo, run npm i to install the dependencies and go off and have a cup of tea while npm downloads all the dependencies. Now, there are ways that you can download a single npm dependency to a centrally managed folder, which will create a symlink for you locally, but as far as I can see, there's no way to tell something like Angular to do this with every package so my diskspace gets eaten up by 100s of Mb of duplicated packages on every install.
Pete O'Hanlon wrote:
So, I do a lot of Angular development.
My condolences. :rose:
Pete O'Hanlon wrote:
there's no way to tell something like Angular to do this with every package
As much as I dislike Angular, can't blame it for this issue. This would be an
npm
thing. IMO localized packages are better and less error prone. That being said, the first real issue here is Angular is bloatware. :) Also, make sure the devs working on it don't add a new package for _every last thing in the world_ that could easily be done with vanilla JS. Buuutttt, since you passed the point of no return it seems,npm
supports the ability to always use a global folder no matter what. [https://docs.npmjs.com/cli/v9/using-npm/config#global\](https://docs.npmjs.com/cli/v9/using-npm/config#global) Just stick that bad boy in anpmrc
file in your home directory (~/.npmrc) and nuke the oldnode_modules
folders for your projects and try again. Keep in mind, you'll still probably have a localnode_modules
folder because packages use it for other things (not sure, never tried) but if you do it should be a lot smaller at least.Jeremy Falcon
-
So, I do a lot of Angular development. I help out with a number of projects, all of which have their own npm dependencies. My typical workflow with a new project is to git clone the repo, run npm i to install the dependencies and go off and have a cup of tea while npm downloads all the dependencies. Now, there are ways that you can download a single npm dependency to a centrally managed folder, which will create a symlink for you locally, but as far as I can see, there's no way to tell something like Angular to do this with every package so my diskspace gets eaten up by 100s of Mb of duplicated packages on every install.
Also, if these packages are interdependent, it may be worthwhile looking into peer dependencies too. My first post is the quick fix, but peer dependencies are technically another option. They shouldn't be abused however, but it's an option.
Jeremy Falcon
-
So, I do a lot of Angular development. I help out with a number of projects, all of which have their own npm dependencies. My typical workflow with a new project is to git clone the repo, run npm i to install the dependencies and go off and have a cup of tea while npm downloads all the dependencies. Now, there are ways that you can download a single npm dependency to a centrally managed folder, which will create a symlink for you locally, but as far as I can see, there's no way to tell something like Angular to do this with every package so my diskspace gets eaten up by 100s of Mb of duplicated packages on every install.
Pete, Python. Python, meet Pete. You two will hate each other...
cheers Chris Maunder
-
Pete O'Hanlon wrote:
So, I do a lot of Angular development.
My condolences. :rose:
Pete O'Hanlon wrote:
there's no way to tell something like Angular to do this with every package
As much as I dislike Angular, can't blame it for this issue. This would be an
npm
thing. IMO localized packages are better and less error prone. That being said, the first real issue here is Angular is bloatware. :) Also, make sure the devs working on it don't add a new package for _every last thing in the world_ that could easily be done with vanilla JS. Buuutttt, since you passed the point of no return it seems,npm
supports the ability to always use a global folder no matter what. [https://docs.npmjs.com/cli/v9/using-npm/config#global\](https://docs.npmjs.com/cli/v9/using-npm/config#global) Just stick that bad boy in anpmrc
file in your home directory (~/.npmrc) and nuke the oldnode_modules
folders for your projects and try again. Keep in mind, you'll still probably have a localnode_modules
folder because packages use it for other things (not sure, never tried) but if you do it should be a lot smaller at least.Jeremy Falcon
Jeremy Falcon wrote:
IMO localized packages are better and less error prone.
I agree strongly. Always seemed like potentially a failure path that would just show up unexpectedly. Same thing happens when a developer decides to use a new library which requires multiple other libraries to be updated (tens or even more.) And yet when I mention that this now requires a full regression they can't understand why.
-
So, I do a lot of Angular development. I help out with a number of projects, all of which have their own npm dependencies. My typical workflow with a new project is to git clone the repo, run npm i to install the dependencies and go off and have a cup of tea while npm downloads all the dependencies. Now, there are ways that you can download a single npm dependency to a centrally managed folder, which will create a symlink for you locally, but as far as I can see, there's no way to tell something like Angular to do this with every package so my diskspace gets eaten up by 100s of Mb of duplicated packages on every install.
-
So, I do a lot of Angular development. I help out with a number of projects, all of which have their own npm dependencies. My typical workflow with a new project is to git clone the repo, run npm i to install the dependencies and go off and have a cup of tea while npm downloads all the dependencies. Now, there are ways that you can download a single npm dependency to a centrally managed folder, which will create a symlink for you locally, but as far as I can see, there's no way to tell something like Angular to do this with every package so my diskspace gets eaten up by 100s of Mb of duplicated packages on every install.
Better you get frustrated instead everybody else who just want to clone one project and have it build without hunting for missing libraries, wrong versions and missing shared folders.
Advertise here – minimum three posts per day are guaranteed.
-
Pete O'Hanlon wrote:
So, I do a lot of Angular development.
My condolences. :rose:
Pete O'Hanlon wrote:
there's no way to tell something like Angular to do this with every package
As much as I dislike Angular, can't blame it for this issue. This would be an
npm
thing. IMO localized packages are better and less error prone. That being said, the first real issue here is Angular is bloatware. :) Also, make sure the devs working on it don't add a new package for _every last thing in the world_ that could easily be done with vanilla JS. Buuutttt, since you passed the point of no return it seems,npm
supports the ability to always use a global folder no matter what. [https://docs.npmjs.com/cli/v9/using-npm/config#global\](https://docs.npmjs.com/cli/v9/using-npm/config#global) Just stick that bad boy in anpmrc
file in your home directory (~/.npmrc) and nuke the oldnode_modules
folders for your projects and try again. Keep in mind, you'll still probably have a localnode_modules
folder because packages use it for other things (not sure, never tried) but if you do it should be a lot smaller at least.Jeremy Falcon
So, I couldn't find any mention of this when I was crashing around the npm docs. Your google-fu is strong Master Falcon.
-
So, I couldn't find any mention of this when I was crashing around the npm docs. Your google-fu is strong Master Falcon.
Yeah, I dunno why, but it is hard to find. I just got frustrated with stuff myself not too long ago and went through the docs. So I, err we, got lucky. :laugh:
Jeremy Falcon
-
Pete O'Hanlon wrote:
100s of Mb of duplicated packages on every install.
How many other projects do you work on? Might be annoying but these days a couple of hundred megs isn't much. Even could use it as an excuse to get a better and bigger harddrive.
I am currently helping 14 different projects.
-
Pete, Python. Python, meet Pete. You two will hate each other...
cheers Chris Maunder
... and Chris lights the match...
Software Zen:
delete this;