Skip to content

npm 12: document and test the --allow-scripts install command - #476

Open
jmandel wants to merge 1 commit into
HealthIntersections:2026-12-gg-npm-checkfrom
jmandel:npm12-allow-scripts
Open

jmandel wants to merge 1 commit into
HealthIntersections:2026-12-gg-npm-checkfrom
jmandel:npm12-allow-scripts

Conversation

@jmandel

@jmandel jmandel commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

On top of #473 (base is its branch). Makes the "Published install (npm latest)" leg pass and documents the install command npm 12 needs.

Cause

npm 12 doesn't run the install scripts of dependencies unless they are allowed, and for npm install -g it doesn't read the allowScripts in the installed package's package.json: only the command line or the user's npm config counts. sqlite3, better-sqlite3 and roaring get their native binary from an install script, so a plain npm install -g fhirsmith with npm 12 ends without an error and the server can't load them. bcrypt and koffi load anyway.

This isn't specific to 1.1.0. Installed from the registry into a scratch prefix, Node 24.16.0:

npm fhirsmith roaring sqlite3 better-sqlite3
11.21.3 1.0.12 not a dependency loads loads
11.21.3 1.1.0 loads loads loads
12.2.3 1.0.12 not a dependency no bindings no bindings
12.2.3 1.1.0 no binary no bindings no bindings
12.2.3 1.1.0 with --allow-scripts=... loads loads loads

The tar shim plays no part: vendor/ isn't in the package and npm doesn't apply a package's overrides when the package is itself installed (every nested tar in the 1.1.0 install is plain tar 7.5.24). What is new in 1.1.0 is that roaring is a dependency, so it joins the blocked list.

Changes

  • published-install-check.yml: both legs install with --allow-scripts=bcrypt,better-sqlite3,koffi,roaring,sqlite3 (the list npm itself prints)
  • README: the npm install command has the option, with a short explanation and the once-per-user alternative (npm config set allow-scripts=... --location=user)
  • CHANGELOG 1.1.1: the ips/vendor/ fix from fix .npmignore, and add test for working npm image #473 and this

Checked

This branch packed and installed with that command under npm 11.21.3 and npm 12.2.3, then check-installed-package.js on the installed copy: complete, all five native modules load, ips/vendor/ has its 5 files.

Installing with npm 12

With npm 12 the install command needs one extra argument:

npm install -g --allow-scripts=bcrypt,better-sqlite3,koffi,roaring,sqlite3 fhirsmith

The package can't set this for the user, so it goes in the README as the install command.

🤖 Generated with Claude Code

npm 12 doesn't run the install scripts of dependencies unless they are
allowed, and for npm install -g it doesn't read the allowScripts in the
installed package's package.json. sqlite3, better-sqlite3 and roaring
are then left without their binary. The README install command and the
published install check now pass --allow-scripts.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant