What actually changed in npm 12
On July 8, 2026, GitHub made npm v12 generally available and tagged it latest. The headline change is simple: lifecycle scripts from dependencies (preinstall, install, postinstall) and implicit node-gyp builds no longer run unless your project explicitly allows them. The allowScripts setting defaults to off. Git dependencies and remote tarball URLs are also blocked by default unless you pass the new allow flags.
This did not come out of nowhere. The first half of 2026 was rough for the JavaScript ecosystem. The Cloud Security Alliance documented a run of incidents including a self-propagating npm worm in March, a compromise of 42 TanStack packages in May, and a wave that pushed 637 malicious versions across 323 AntV packages in about 27 minutes. A common thread was code that executed the moment someone ran npm install.
Turning install scripts off by default removes the easiest path for that kind of attack. It does not make dependencies safe, but it means a poisoned package has to be imported and executed by your code before it can do damage, instead of firing on install in a CI runner full of secrets.
What breaks, and where you will notice it
Most pure JavaScript packages never needed install scripts, so a lot of projects will upgrade without noticing. The packages that do need them are the usual suspects: native modules that compile on install, tools that download platform-specific binaries, and anything that patches itself after install. If one of those is in your tree and not on the allowlist, you will see a failure at runtime or during build rather than at install time, which is the confusing part.
Git and remote URL dependencies are the other trap. Teams that pin a fork straight from a Git repository or pull a tarball from an internal server will find npm refusing to resolve it until they opt in. In my experience these are often forgotten workarounds from years ago, so this is a good moment to find out why they exist.
The quickest way to find out is to stop guessing. Run a clean install with the new defaults on a branch, then run your build and tests. Whatever fails tells you exactly which packages need a decision, and the list is usually shorter than people fear.

A migration path that works
GitHub's recommended path is to run npm 11.16.0 or newer first, where the new behavior shows up as warnings. Then run npm approve-scripts --allow-scripts-pending, review what it lists, and commit the resulting allowlist in package.json. Treat that allowlist like any other security-relevant config: it gets code review, and every new entry needs a reason.
On our projects at XY Group we do this in a dedicated branch, run the full test suite plus a clean container build, and only then bump the npm version in CI. Pin the npm version in your pipeline explicitly. Letting CI pick up a new major version on its own schedule is how you end up debugging a broken build at 6 p.m. on a Friday.
Do not skip the token changes
The same changelog started deprecating the most sensitive uses of granular access tokens that bypass two-factor authentication. Account management actions lose the bypass first, and GitHub says that around January 2027 these tokens will lose direct publishing rights, keeping only read access to private packages and staged publishes that need human 2FA approval.
If you publish packages from CI with a long-lived token, plan the move to trusted publishing via OIDC or staged publishing now. It is a small project, and it closes the exact hole many of this year's attacks walked through: a stolen token that could publish without anyone noticing.
While you are there, audit who can publish your packages at all. Remove former employees and contractors, require two-factor authentication for every maintainer and make sure nobody's personal token is quietly doing the job of a CI identity.
