Skip to main content
Journal

EngineeringPrimeCode WebWorks7 min readNov 25, 2026

npm 12 skips install scripts: what breaks in Nuxt and Laravel builds

npm 12 no longer runs dependency install scripts by default. Why that blunts the next npm worm, which packages in a Nuxt or Laravel build need approval, and how to fix CI first.

SecurityNuxtUpgrades
A laptop screen shows lines of code in a code editor in a dark room.

If your Nuxt site or Laravel app builds with npm, your next deploy may behave differently. npm 12 no longer runs install scripts from dependencies unless you approve them. That closes the door most npm worms used. It also means a native package can install “successfully” and then crash the app when it loads. Here is what changed, what breaks, and how we fix the build before the December code freeze.

What npm 12 changed

GitHub made npm 12 generally available on 8 July 2026. The defaults that matter:

  • Dependency install scripts are skipped. preinstall, install and postinstall scripts, and implicit node-gyp builds, only run for packages listed in the allowScripts field of your root package.json. Your own project’s scripts still run.
  • Git and remote-URL dependencies are not resolved unless you allow them with --allow-git or --allow-remote.
  • The skip is soft. npm prints a warning and the install succeeds. With the opt-in strict-allow-scripts setting, a skipped script becomes an error.

Which npm you get depends on your Node version. The npm team said it hopes to backport npm 12 to Node 24 and 26, but that is up to Node’s release team, so run npm -v on your laptop and on the build server before assuming either way.

Why: the worms ran on install

The Shai-Hulud worm has hit the npm registry in waves since September 2025. The early waves ran their payload from install scripts: the moment a developer or CI server installed a poisoned version, the script searched the machine for npm, GitHub and cloud tokens. It then used those tokens to publish poisoned versions of every package the victim could publish.

The pattern kept going in 2026. In May, the “Mini Shai-Hulud” wave pushed 637 malicious versions across 317 packages from one account. On 4 August, the ChainDrop variant hit popular packages including keyv and cacheable; TechRadar reported at least 868 affected packages. Blocking install scripts by default does not stop a poisoned package from reaching you, but it stops the most common way it runs on install.

What breaks in a Nuxt or Laravel build

Most front-end tooling is fine. esbuild and similar tools ship platform binaries as optional dependencies, so they need no script. The trouble is packages that compile or download something during install.

Package type Examples What you see if the script is skipped What to do
Native database drivers better-sqlite3 Install passes, app fails at start with a missing bindings error Approve the pinned version
Image processing sharp (used by Nuxt Image) Usually fine if a prebuilt binary exists for your server Check the pending list and test an image route
Password hashing bcrypt Login fails at runtime Approve, or use bcryptjs or hash in Laravel
Browser downloaders Playwright, Puppeteer, Cypress Tests fail: browser not found Run the browser install as an explicit CI step
Old Sass node-sass Styles fail to build Replace with sass

A stock Laravel app usually has nothing to approve: npm run build only runs Vite. Nuxt apps with server-side SQLite, image processing or end-to-end tests are where we see the warnings. Our own site’s CMS uses better-sqlite3, so it is on our list too.

Approve scripts the safe way

Run this first. It only lists packages and changes nothing:

npm approve-scripts --allow-scripts-pending

For each package on the list, decide whether it truly needs to run code on install. Then approve only those:

npm approve-scripts better-sqlite3
npm deny-scripts some-package

By default approve-scripts writes a pinned entry such as better-sqlite3@12.11.1, so a new version needs a fresh approval. Keep that default. A false entry always wins, so a package you deny cannot be re-approved by accident. Commit package.json and review allowScripts changes like any other code change.

GitHub’s advice for teams not yet on npm 12 is to move to npm 11.16.0 or later first, install as normal, and read the warnings. That gives you the list before anything breaks.

Make CI fail loudly

A soft skip is fine on a laptop. On a build server it hides a broken release until a customer finds it. Our CI setup:

  • npm ci with a committed lockfile, never npm install, on the build server.
  • strict-allow-scripts on in CI, so an unapproved script stops the build instead of shipping a broken app.
  • One smoke test that loads each native module, such as opening the SQLite database, after install.
  • No publish tokens or cloud admin keys on the build machine. If a poisoned package does run, it should find nothing worth stealing.

If you use pnpm, version 10 already blocked dependency scripts by default. The same review applies.

If you publish packages: January 2027

Most SMEs only install packages, but if your team publishes private or public ones, plan for two token changes GitHub announced with npm 12. From early August 2026, granular tokens set to bypass 2FA can no longer manage accounts, tokens or package access. From January 2027, they are scheduled to lose direct publishing. A release then needs trusted publishing from CI or a person approving with 2FA.

This is the same habit that keeps Laravel upgrades predictable in our PHP 8.6 upgrade order: change one thing, prove it in CI, then ship. It also fits the release discipline in our Nuxt 3 end-of-life guide.

Straight next step

If you are not sure what your build server runs, send us your package.json, your lockfile and how you deploy today. Use our contact page. We will run the pending check, say which scripts your app really needs, and set up CI so the next npm default change does not reach your customers.

For the apps behind these builds, see our custom web application service.

Related

More from the journal.

Start

Building something similar?

Tell us what you are planning — a founder or studio lead replies within one business day.