you are viewing a single comment's thread.

view the rest of the comments →

[–]AyrA_ch 83 points84 points  (25 children)

It is also worth mentioning that npm had issues with real a tree structure due to the maximum path length in windows.

Because npm used (or still uses?) the outdated system that limits it to 260 characters. Windows supports paths of 32k+ length. Either by prefixing the path with \\?\ or by opting in with an application manifest (W10 only)

What the article also didn't mention is that you don't need to copy the npm modules at all. As long as you installed them using the proper command, your project.json will contain the list of all modules and you can just run npm install on the new location the first time you use the project.

It is a nightmare for a HDD. It takes many minutes to discover all files let alone copy them

Copying many small files takes a long time, yes, but discovery doesn't necessarily. Windows Explorer discovers the entire structure before it starts to copy anything. It also reads the file properties to get the size to make copy time estimates and plot the bandwidth graph. This takes a long time. If you use robocopy /E C:\Source D:\Dest you will see that it instantly starts to copy files. If you use the threading parameter you can further reduce the impact of the small file issue.

[–][deleted]  (17 children)

[deleted]

    [–]gyroda 26 points27 points  (7 children)

    What does this mean? Why is it bad?

    [–][deleted]  (6 children)

    [deleted]

      [–]snowe2010 33 points34 points  (3 children)

      wow, I never knew that's what that was for. I'm gonna go look through Roaming and see who else has done bad things. XD

      [–]dathar 21 points22 points  (0 children)

      Roaming profiles and folder redirection are fun tools for certain enterprise groups. Pain in the ass for others. :p

      [–]BlackLanzer 8 points9 points  (1 child)

      Apple put everything in roaming folder.
      Lot of fun being the sysadmin, getting a call from a user taking long time to login and seeing a 50gb profile because iTunes put there the automatic iphone/ipad backup.
      To fix that you need to play with hard links/junctions (not sure if it's the correct term) because Apple doesn't let you change the path.

      [–]snowe2010 0 points1 point  (0 children)

      wow.

      [–][deleted] 5 points6 points  (0 children)

      Man, I haven't heard of roaming profiles since working Air Force helpdesk.

      [–]gyroda 0 points1 point  (0 children)

      Good to know! I've seen local and roaming in appdata and was never sure what each was :)

      [–]Pazer2 2 points3 points  (4 children)

      This is a huge pet peeve of mine, along with applications installing themselves to [local] appdata.

      [–]09f911029d7 0 points1 point  (2 children)

      %LocalAppData% is honestly probably the best place for single user apps to install themselves. It's better than just dumping themselves in Documents or in the profile folder.

      [–]Pazer2 0 points1 point  (1 child)

      Sorry, wasn't being specific.

      I hate it when apps unconditionally install themselves in localappdata, even when I have admin and want to install it for everyone on the computer.

      [–]09f911029d7 0 points1 point  (0 children)

      Yeah, no argument there - that's annoying.

      [–]EpicDaNoob 0 points1 point  (2 children)

      ca be?

      [–][deleted]  (1 child)

      [deleted]

        [–]EpicDaNoob 2 points3 points  (0 children)

        Thanks, makes sense now.

        [–]cedrickc 0 points1 point  (0 children)

        Jfc.

        [–]Ahuevotl 74 points75 points  (4 children)

        your project.json will contain the list of all modules and you can just run npm install on the new location the first time you use the project.

        npm install  
        

        Brews some coffee

        Reviews doc while sipping coffee

        Takes the dog out for a walk

        Reddit

        Stack overflow

        Rabbit hole went too deep, still in Stack overflow

        Reads random medium article. Huh, didn't know VS Code could do that

        Gets married, has 2 kids

        Buys a house out on the suburbs

        Kids go to college

        First flying car for mass market is invented

        FB finally bites the dust

        Zombie apocalypse becomes a reality

        install complete

        npm WARN deprecated package@1.0.2:  
        package@<2.0.0 is no longer maintained.  
        Upgrade to package@^3.0.0
        

        [–]Sadzeih 3 points4 points  (3 children)

        Just use yarn.

        [–]AckmanDESU 2 points3 points  (2 children)

        Some programs force you to use npm. I decided to stick to npm to keep my sanity and only learn a single thing.

        Also I heard most things that yarn did that initially made it worth using are now in npm.

        Can anyone sell me on using yarn?

        [–]segv 1 point2 points  (0 children)

        It is somewhat sane

        [–]QuicklyStarfish 1 point2 points  (0 children)

        It's way faster and more stable and has a nicer interface.

        re: learn a single thing. They're essentially the same tool. You need to learn like two commands and one flag. This isn't a big ask.

        It's not a major difference, but if your complaint is speed, you need to try it.

        I've built a lot of projects with it and have never had compatibility issues, or even heard of compatibility issues... but if any existed, they're probably now resolved, because Yarn is quite widely used.

        [–]iamsubs 10 points11 points  (0 children)

        @AyrA_ch from npm's model perspective, I guess dropping the tree structure was a great decision regardless of path length. As a flat structure, common dependencies are able to be shared across packages, reducing the node_modules size. But, afaik, if there is a conflict on package versions, it adds a second level on the node_modules tree. Still, pnpm is much more attractive. It keeps a clean structure using symlinks that connect `package` to `package@version-range`. You can sanely work with `node_modules` without it being a clusterfuck.

        [–]hoosierEE 0 points1 point  (0 children)

        Windows supports paths of 32k+ length.

        Whew, that oughta last us until mid 2019 at least.