Upcoming breaking changes for npm v12(github.blog)
369 points by plasma 2 days ago | 143 comments
tl;dr: npm v12 (July 2026) will disable several install-time behaviors by default: lifecycle scripts (preinstall/install/postinstall, including implicit node-gyp builds) won't run unless explicitly allowlisted via `npm approve-scripts`, and Git and remote URL dependencies will require `--allow-git` and `--allow-remote` flags respectively. These changes are already available as warnings in npm 11.16.0+, so users can run installs now, review warnings, approve trusted packages, and commit the resulting allowlist to package.json before upgrading.
HN Discussion:
  • Postinstall scripts have long been a security menace and should have been disabled sooner
  • ~npm is belatedly catching up to safer defaults already adopted by pnpm
  • Questions about implementation details like version pinning, global installs, and LTS Node bundling
  • Per-package allowlisting enables better org-wide policy management, possibly via linters
  • Skepticism about npm/GitHub's overall governance and registry trustworthiness