Reputation: 1952
TL;DR
Is there a way to check npm broken packages when migrating from node v4 to node 8?
Long Story: I have a production application running on node v4. And my moral values are pushing me to upgrade from v4 to v8. I know for a fact my code won't break but I want to be sure with my packages too. I have staging env setup. I can setup node 8 there first. Yet I want to be fully confident, that nothing will break. or simply I want the transition to be smooth. What are the best practices to do so?
Upvotes: 5
Views: 16824
Reputation: 7004
If you have unit-tests for you project (you should), if your tests still pass on Node 8, you're probably OK.
Note that Node 8 comes with npm v5 bundled with it. You'll want to make sure you have a clean install of node_modules
before testing (i.e. you should rm -rf node_modules
, then reinstall your dependencies). npm 5 has a flatter dependency tree than npm 2 (which comes with Node 4), so in a few rare cases, that can cause things to break.
When you're running the fresh install on Node 8, watch for any warning output that would indicate trouble, especially for incompatible engine messages.
Also, npm 5 creates package-lock.json
files by default, you may want to look into this in greater detail here: https://stackoverflow.com/a/44297998/7127751.
If you want to be really safe, check all your dependencies and see if the version you're using is being tested on Node 8 (i.e. check the .travis.yml
file in each dependency's repository).
Upvotes: 6