Presenting v7.0.0 of The NPM CLI

Presenting v7.0.0 of The NPM CLI

We are excited to announce the release of NPM v7.0.0, which will be shipping with Node.js 15.0.0 next week. npm 7 comes with some long-awaited and requested features: Workspaces; Automatically installing peer dependencies; package-lock v2 and support for yarn.lock

It’s hard to believe that just over 11 years ago the JavaScript community didn’t have npm. Fast forward to today, and npm now has millions of developers and over 1.3M packages with 75B downloads a month.

We first introduced npm v7 back in May. Today, we are excited to announce the release of npm v7.0.0, which will be shipping with Node.js 15.0.0 next week. If you would like to try it out now, you can install today by running npm i -g [email protected] in your terminal.

Exciting new features

npm 7 comes with some long-awaited and requested features including:

  • Workspaces: a set of features to the npm CLI that provide support to managing multiple packages from within a singular top-level, root package
  • Automatically installing peer dependencies: prior to npm 7 developers needed to manage and install their own peer dependencies. The new peer dependency algorithm ensures that a validly matching peer dependency is found at or above the peer-dependent’s location in the node_modules tree.
  • package-lock v2 and support for yarn.lock: Our new package-lock format will unlock the ability to do deterministically reproducible builds and includes everything npm will need to fully build the package tree. Prior to npm 7 yarn.lock files were ignored, the npm cli can now use yarn.lock as source of package metadata and resolution guidance.

What’s old is new again

The internals of npm have been significantly refactored. There has been a large effort on separating concerns. For example, the inspection and management of the node_modules tree has been moved to the module Arborist. You can read about Arborist in this post on the npmjs blog.

These internal changes will ensure that the npm code base is more reliable over time and easier to maintain. With fewer bugs and a faster iteration cycle we will be able to deliver updates to npm faster than ever before.

We’ve been smoke-testing npm 7.0.0 using the Node.js smoke testing suite CITGM and are happy to report that despite massive internal changes, there are no new modules failing with npm 7 vs npm 6 when run against 120+ highly relied upon modules!

Breaking changes

Despite the massive overhaul to the internals of npm, the team has worked tirelessly to ensure that there will be minimal disruptions to most workflows. That said, some breaking changes are necessary to improve the overall developer experience. Breaking changes in npm 7.0.0 include:

  • Automatically installing peer dependencies (while this feature is something we think is desirable new behavior, it does potentially break certain workflows).
  • npm uses the package.exports field making it no longer possible to require() npm’s internal modules.
  • npx has been completely rewritten to use the npm exec command. There are various changes in functionality, most noticeable being a prompt if the module you are trying to run is not yet installed.
  • The output of npm audit has significantly changed both in the human-readable and --json output styles.

To learn more about the breaking changes in npm 7.0.0 please check out our in-depth post on the blog.

What’s next

We know npm 7 is a big change, and we want to take extra care to not break the millions of workflows that use npm, especially in production. For this reason, we are going to take a page from Node.js and roll this release out over time.

npm 7.0.0. will not be marked as latest; your workflows will not get npm v7.0.0 by default unless you opt in by running npm install -g [email protected] or install Node.js 15.

While we are confident that this release is ready to use daily, we want more real world use to get your feedback and bug reports. When we are sure that npm 7 has met the bar to be included in a Node.js LTS release, we will be publishing the release line as latest.

We will also continue to improve the npm CLI with new features including improvements to workspaces and package overrides. If you have ideas for features for the npm CLI please check out our RFC repo and open an issue!

npm node javascript programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Top Node.js Development Companies and Expert NodeJS Developers

A thoroughly researched list of top NodeJS development companies with ratings & reviews to help hire the best Node.JS developers who provide development services and solutions across the world. List of Leading Node.js development Service Providers...

Hire Node.JS Developers | Skenix Infotech

We are providing robust Node.JS Development Services with expert Node.js Developers. Get affordable Node.JS Web Development services from Skenix Infotech.

JavaScript Full Course - Beginner's Guide to JavaScript on Node.js

This complete 51-part JavaScript tutorial for beginners will teach you everything you need to know to get started with the JavaScript on Node.js. JavaScript Full Course - Beginner's Guide to JavaScript on Node.js

NODE.JS 15 – DAS IST ALLES NEU | Node.js 15 und npm 7 sind erschienen

NODE.JS 15 – DAS IST ALLES NEU | Node.js 15 und npm 7 sind erschienen. Node.js 15 ist erschienen – und Node.js 14 LTS kommt nächste Woche! Die neue Version enthält zahlreiche große und kleine Neuerungen, unter anderem in Bezug auf das Abbrechen von Promises, den Umgang mit Zeichenketten, die verwendete V8-Version, und vieles mehr. Außerdem enthält Node.js 15 die neue npm-Version 7. Was das alles im Detail bedeutet und wie Du am besten auf Node.js 15 aktualisierst, erfährst Du im Developer's Special in unserem Video.

A Beginner’s Guide to NPM, the Node Package Manager

What is NPM? NPM stands for Node Package Manager and is one of the multiple package managers available for the Javascript programming language. This article is a gentle introduction into what NPM is and what it does for you.