What's new in npm 8?
“The art of being wise is knowing what to overlook.” ― William James
I know, right? npm 8 was released just a couple of months ago and you’re looking for a blog post that summarizes all the changes and new stuff in the new version because you want to be ahead of the curve or simply don’t want your app to crash when upgrading. You googled but nothing relevant appeared; only a document from Github blog that refers to this issue on the npm organization. And getting into the depths of the repo itself to check the changelog and decipher its arcane liturgy is just too much work. Well, you’re so lucky because you came to the right place.
First off, if you only want the TL;DR, here it is (drum roll 🥁)...
About npm 8
If you’re using the latest release of an active LTS version of Node.js and want to jump from npm@7 to npm@8, nothing much has changed; hence, your application most likely will stand the test of upgrading to the latest major version. That’s just about it. See https://github.com/npm/rfcs/issues/445#issuecomment-945313849
Oh... still here? OK, I get it, either you’re utilizing a sunsetted version of Node.js or want to know more. Well, npm 8.0.0 was released with the main purpose of dropping support for those no longer maintained Node versions and require(npm)
. Some sub dependencies that also dropped Node 10 support were also updated and the version of node-gyp
is now 8.
So, you might ask -same as I did-
“why bother increasing the major number?”.
The answer is dead simple: the aforementioned breaking changes will require a bump up on the major number, as per semver’s guidelines.
Other new features in npm 8
However, there are some neat features added in the subsequent minor releases, such as:
- The
--lockfile-version, --include-workspace-root
, and explicit--no-workspaces config options
(v8.1.0). - Streaming the debug logfile (v8.2.0).
- Introducing overrides, output configured registry during publish, and display
publishConfig
duringconfig list
(v8.3.0).
We’ll talk about these and many others in the latest revision of our “npm tips and tricks” guide coming out in the next few days. Stay tuned.😎
Have an older version of Node.js?
- Wait!... Don’t leave just yet!… 😰 What about those of us still stuck into older Node.js versions?
Well then, your options are sticking to npm@7 or -most advisable- migrating to the latest Node LTS, which at the time of the writing of this post is v16. This process can get quite difficult oftentimes based on the complexity of your app and its dependencies but you can always hit us up and set some time to talk with our NodeSource Services Team who are keen to help and guide you through.