Works with the AI Agents you already use
npm 12 Install Scripts Fix: Approve Only the Packages That Must Run
Fixes installs broken by npm 12's blocked install scripts and git/URL dependencies with a tested, minimal allowScripts policy and a pass/fail report.
$1
npm 12 Install Scripts Fix: Approve Only the Packages That Must Run
Example session with this skill installed
We moved CI to npm 12 and now require('bcrypt') fails with "Cannot find module". The project uses esbuild, bcrypt, sharp, lodash and husky. Fix the install policy without just allowing everything.
- Read your context and instructions
- Compiled the npm 12 install
npm 12 install-policy report: demo-app
Date: 2026-11-05 · npm 12 · Node 22 · Platforms tested: Linux x64
Verdict
PASS WITH EXCEPTIONS: 1 approval needed; macOS, Alpine and ARM not verified.
Packages with install-time scripts
| Package@version | Script | Class | Works without script? (evidence) | Decision |
|---|---|---|---|---|
| bcrypt@5.1.1 | install: node-pre-gyp install --fallback-to-build | Required | No: require('bcrypt') → Cannot find module (native binding) | npm approve-scripts bcrypt → "bcrypt@5.1.1": true |
| esbuild@0.25.12 | postinstall: node install.js | Optional | Yes: transformSync of TS succeeded | No entry |
| sharp@0.34.5 | install: node install/check.js || npm run build | Optional | Yes: require('sharp') loaded | No entry |
Git / remote-URL dependencies
None found.
Verification
| Check | Command | Result |
|---|---|---|
| Clean install | rm -rf node_modules && npm ci | pass |
| Pending approvals | npm approve-scripts --allow-scripts-pending | none |
| Scanner | python3 scripts/scan_install_policy.py . | exit 0 |
| bcrypt loads after rebuild | npm rebuild bcrypt && node -e "require('bcrypt')" | pass |
Connects securely to your tools. The creator never sees your data.
About this skill
npm 12 (generally available since 8 July 2026) no longer runs dependency preinstall, install or postinstall scripts, or implicit node-gyp builds, unless the project allows them. It also refuses git dependencies and remote-URL tarballs by default. Installs still "succeed", so the breakage shows up later: a native addon fails to load, a binary is missing, a build step in CI or Docker breaks. This skill turns that into a short, checkable job: inventory every blocked item, prove which ones the project actually needs, write the smallest allowScripts policy that works, fix non-registry sources, and verify with a clean install. The result is a written report plus the exact package.json / .npmrc / CI changes.
- Moving a project, CI runner or Docker image to npm 12 (or to npm 11.16+, which already warns).
- "It worked yesterday":
Cannot find module '.../build/Release/*.node', a missing binary, or a package that expects its postinstall to have run. - npm prints a list of packages whose install scripts were skipped.
npm installrefuses agit+https://,github:orhttps://…/*.tgzdependency.- Hardening a repository after a supply-chain incident: you want install-time code execution limited to a reviewed list.
Not for: pnpm, Yarn or Bun projects (they have their own approval models; see Pitfalls), or for auditing packages for CVEs.
| Fact | Source |
|---|---|
npm v12 is GA and tagged latest; allowScripts defaults to off; dependency preinstall/install/postinstall and implicit node-gyp builds don't run unless allowed | GitHub changelog, 2026-07-08 |
--allow-git and --allow-remote default to none in npm 12; --allow-file / --allow-directory defaults unchanged | GitHub changelog, 2026-06-09; npm v12 config docs |
A package with binding.gyp and no install script is still blocked (implicit node-gyp rebuild); prepare scripts of git/file/link dependencies are blocked too | GitHub changelog, 2026-06-09 |
| Install commands skip unapproved scripts and end with a list of skipped packages; install does not fail by default | npm v12 approve-scripts docs; npm community discussion #198547 |
npm approve-scripts <pkg> writes pinned pkg@x.y.z entries by default; --no-allow-scripts-pin writes name-only entries; --all approves everything pending; --allow-scripts-pending lists pending packages (read-only) | npm v12 approve-scripts docs |
npm deny-scripts <pkg> writes name-only false entries; false always wins | npm v12 deny-scripts docs |
| Both commands are "unaware of workspaces" | npm v12 docs |
--allow-scripts=a,b is for npx, npm exec and npm install -g; passing it to a project-scoped install/ci/update/rebuild is an error | npm v12 config docs |
dangerously-allow-all-scripts bypasses the policy; --ignore-scripts still takes precedence; strict-allow-scripts turns skipped scripts into a failed install | npm v12 config docs |
Covers npm only; pnpm, Yarn and Bun use different approval settings. Tests run on the agent's machine, so other operating systems and CPU architectures are reported as not verified rather than assumed. Some npm 12 behaviours were undocumented at the time of checking (root-project scripts, workspaces placement, which Node.js release bundles npm 12); the skill tells the agent to verify these on the user's npm version. The scanner treats version-range allowScripts keys conservatively (exact versions only) and may flag them for review.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 12 days ago
Requires
Permissions
Allowed Hosts
File Scopes
The bundled scanner is read-only and makes no network calls. Dependency scripts are never run before they are reviewed; installs start with --ignore-scripts.