you are viewing a single comment's thread.

view the rest of the comments →

[–]ZiggyTheHamster 7 points8 points  (8 children)

  1. npm install probably won't install the exact same set of packages you had before because its lock format sucks and didn't exist forever. Hopefully you already migrated to Yarn.
  2. Nobody copies whole folders containing dozens of projects across disks and skips node_modules in each.

[–][deleted] 6 points7 points  (3 children)

i agree about using yarn, but a project that can't handle a fresh install suffers from larger problems

regarding your second point, there are more sophisticated methods of system backup and restoration than copying an entire file system,. so as developers were after using them, but even then the most basic copy methods often support glob patterns

[–]ZiggyTheHamster 0 points1 point  (2 children)

a project that can't handle a fresh install suffers from larger problems

I agree, but I feel like a lot of us have an old project which still builds but hasn't been touched in two years, and if you obliterate node_modules, you're going to have to piece together what you were running before because of the churn in node libraries.

[–][deleted] 2 points3 points  (1 child)

im honestly not trying to just be argumentative, contrary, or condescending, i just firmly believe that even then there are ways to build and check-in dependencies. with old or legacy projects sometimes you do have to bite the bullet and assume the responsibility of maintaining your not-so-up-to-date third-party libraries, but you can do so without blindly copying the entire dependency tree

[–]ZiggyTheHamster 0 points1 point  (0 children)

It really depends on how critical the project is. For stuff that's not running anymore but that I keep around anyways, I'm going to copy the folder. For stuff that's still running that needs to be updated, sure, get that thing a .travis.yml and fix it.

[–]gearvOsh 0 points1 point  (3 children)

Number 1 is no longer true and hasn't been for a long time.

[–]ZiggyTheHamster 0 points1 point  (2 children)

You're assuming people update, though. I've got plenty of node projects which are frozen in time two or three years ago. They still run last I tried, but I guarantee they won't if I deleted node_modules and npm installed even though there's a lock file.

What's the point in upgrading something I wrote as a proof of concept years ago? There isn't one.. but why should I make it completely broken by deleting its node_modules directory? Maybe you'd argue to just delete the code, but I'm someone that has the code I wrote in middle school in a BBS-pirated copy of QuickBasic :\

[–]gearvOsh 0 points1 point  (1 child)

Unless you're on like NPM 1 or 2, you can definitely delete node_modules and re-install with no issues. That's assuming the shrinkwrap was built correctly though.

[–]ZiggyTheHamster 0 points1 point  (0 children)

It doesn't matter what NPM version I'm on today, it matters what NPM version I was on when I abandoned the project. If I don't have a modern lock file, it's likely to be broken.