Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Arrgghhhh! Elephanting Angular, npm and the great vanishing diskspace issue

Arrgghhhh! Elephanting Angular, npm and the great vanishing diskspace issue

Scheduled Pinned Locked Moved The Lounge
javascripthelpcomcollaborationworkspace
12 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Pete OHanlon

    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.

    Advanced TypeScript Programming Projects

    J Offline
    J Offline
    Jeremy Falcon
    wrote on last edited by
    #3

    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 a npmrc file in your home directory (~/.npmrc) and nuke the old node_modules folders for your projects and try again. Keep in mind, you'll still probably have a local node_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

    J P 2 Replies Last reply
    0
    • P Pete OHanlon

      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.

      Advanced TypeScript Programming Projects

      J Offline
      J Offline
      Jeremy Falcon
      wrote on last edited by
      #4

      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

      1 Reply Last reply
      0
      • P Pete OHanlon

        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.

        Advanced TypeScript Programming Projects

        C Offline
        C Offline
        Chris Maunder
        wrote on last edited by
        #5

        Pete, Python. Python, meet Pete. You two will hate each other...

        cheers Chris Maunder

        G 1 Reply Last reply
        0
        • J Jeremy Falcon

          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 a npmrc file in your home directory (~/.npmrc) and nuke the old node_modules folders for your projects and try again. Keep in mind, you'll still probably have a local node_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

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #6

          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.

          1 Reply Last reply
          0
          • P Pete OHanlon

            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.

            Advanced TypeScript Programming Projects

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #7

            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.

            P 1 Reply Last reply
            0
            • P Pete OHanlon

              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.

              Advanced TypeScript Programming Projects

              S Offline
              S Offline
              Single Step Debugger
              wrote on last edited by
              #8

              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.

              1 Reply Last reply
              0
              • J Jeremy Falcon

                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 a npmrc file in your home directory (~/.npmrc) and nuke the old node_modules folders for your projects and try again. Keep in mind, you'll still probably have a local node_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

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #9

                So, I couldn't find any mention of this when I was crashing around the npm docs. Your google-fu is strong Master Falcon.

                Advanced TypeScript Programming Projects

                J 1 Reply Last reply
                0
                • P Pete OHanlon

                  So, I couldn't find any mention of this when I was crashing around the npm docs. Your google-fu is strong Master Falcon.

                  Advanced TypeScript Programming Projects

                  J Offline
                  J Offline
                  Jeremy Falcon
                  wrote on last edited by
                  #10

                  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

                  1 Reply Last reply
                  0
                  • J jschell

                    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.

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #11

                    I am currently helping 14 different projects.

                    Advanced TypeScript Programming Projects

                    1 Reply Last reply
                    0
                    • C Chris Maunder

                      Pete, Python. Python, meet Pete. You two will hate each other...

                      cheers Chris Maunder

                      G Offline
                      G Offline
                      Gary R Wheeler
                      wrote on last edited by
                      #12

                      ... and Chris lights the match...

                      Software Zen: delete this;

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups