npm install scripts not yet covered by allowScripts: how to fix Cannot find module bcrypt_lib.node
Table of contents
- Key takeaways
- Npm warn install-scripts: packages have install scripts not yet covered by allowScripts
- Where does npm 12 come from if my image ships npm 11?
- Cannot find module bcrypt_lib.node: the error that follows
- Which packages break without their install script?
- How to fix it: approve the script and rebuild
- How to fix it in Docker and in continuous integration
- Gotchas I ran into
- Alternatives if you cannot approve right now
- FAQ
- Is the not yet covered by allowScripts warning an error?
- Do I have to approve esbuild or sharp?
- Why does npm install exit 0 when my app does not start?
- Conclusion
- Sources
The install scripts not yet covered by allowScripts warning means a dependency ships an install script nobody approved. npm 11 still runs it. npm 12 blocks it, npm install exits 0 and the app fails later with Cannot find module bcrypt_lib.node. The fix is npm approve-scripts bcrypt followed by npm rebuild bcrypt.
The npm warn install-scripts … install scripts not yet covered by allowScripts warning means a dependency ships an install script that nobody approved in the allowScripts field of your package.json. npm 11 warns and still runs the script. npm 12 blocks it, npm install exits 0, and the failure shows up when the app starts: Cannot find module … bcrypt_lib.node. The fix is npm approve-scripts bcrypt followed by npm rebuild bcrypt. I reproduced it on 25 November 2026 in Docker on arm64 Linux, with node:26-slim (Node 26.13.1) and npm 11.20.0 and 12.2.3, package by package. There is also a Spanish version of this guide.
Key takeaways
- npm 11.19.1, 11.20.0 and 11.21.3 print
not yet covered by allowScriptsand run the script: with them the warning breaks nothing. - npm 12.2.3 prints
had install scripts blocked because they are not covered by allowScripts, skips the script and exits 0. - Of seven packages tested on npm 12.2.3, two fail to load:
bcrypt@5.1.1(Cannot find module … bcrypt_lib.node) andsqlite3@6.0.1(Could not locate the bindings file). npm approve-scripts bcrypt sqlite3writes the approval topackage.json, andnpm rebuildruns the scripts that were skipped.npm approve-scripts --allalso approvedbetter-sqlite3, and itsnode-gyp rebuildbroke the install on theslimimage: deny it instead.npm ci --strict-allow-scriptsturns the warning into theESTRICTALLOWSCRIPTSerror, so the build fails and not the running container.
Npm warn install-scripts: packages have install scripts not yet covered by allowScripts
The warning has two wordings, and the difference between them decides whether your app starts. On npm 11.20.0, the one node:26-slim bundled on 25 November, npm install bcrypt@5.1.1 prints this and runs the script:
npm warn install-scripts 1 package has install scripts not yet covered by allowScripts:
npm warn install-scripts bcrypt@5.1.1 (install: node-pre-gyp install --fallback-to-build)
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.
With two or more packages, the first line becomes N packages have install scripts not yet covered by allowScripts:. I saw the same text on npm 11.19.1 (bundled in node:24-slim back then, Node 24.22.3) and on npm 11.21.3, which both images bundle since 30 November. In all three cases require("bcrypt") worked afterwards.
On npm 12.2.3, the same command switches to the past tense and adds blocked. In this block and the following ones I wrapped the long lines to fit:
added 59 packages in 271ms
npm warn install-scripts 1 package had install scripts blocked
because they are not covered by allowScripts:
npm warn install-scripts bcrypt@5.1.1 (install: node-pre-gyp
install --fallback-to-build)
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review,
or `npm install-scripts approve <pkg>` to allow.
This time the script did not run, and npm install exited 0. The npm install-scripts documentation[1] for version 12.2.3 puts it this way: "Dependency install scripts are blocked by default. Install commands silently skip lifecycle scripts for any dependency that does not have a matching entry in allowScripts".
Where does npm 12 come from if my image ships npm 11?
It comes from a RUN npm install -g npm@latest line in your Dockerfile, or from following the advice npm itself prints. On 25 November 2026 the latest tag of npm on the registry points to 12.2.3, published on 18 November. npm 11.20.0 itself suggests it with the notice New major version of npm available! 11.20.0 -> 12.2.3.
The official images do not ship it yet. According to the Node.js release index[2] as read that day, Node 26.13.1 bundles npm 11.20.0 and Node 24.22.3 bundles npm 11.19.1. Node 26.14.0 and Node 24.23.0, released on 30 November, still stay on npm 11, with 11.21.3. The only line that already bundles npm 12 is the Node 27 alpha: v27.0.0-alpha.0.1.1, from 16 November, ships npm 12.2.2. The block arrived in npm 12.0.0, released on 8 July 2026, whose release notes[3] list it among the breaking changes.
Cannot find module bcrypt_lib.node: the error that follows
Because the install finishes without an error, the failure appears when the module loads, far from the warning that explains it. I built an image with node:26-slim, RUN npm install -g npm@12.2.3 and RUN npm ci --omit=dev for an app with bcrypt@5.1.1 and sqlite3@6.0.1. The docker build succeeded, with the warning about two blocked packages among its 114 installed packages. The docker run exited with code 1:
node:internal/modules/cjs/loader:1607
throw err;
^
Error: Cannot find module
'/app/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node'
Require stack:
- /app/node_modules/bcrypt/bcrypt.js
- /app/server.js
The bcrypt_lib.node file is the native binary that node-pre-gyp downloads or compiles in the install script. Without the script, the lib/binding directory does not exist. The stack ends with code: 'MODULE_NOT_FOUND'.
With sqlite3@6.0.1 the message is different, because the bindings package emits it after looking for the binary in a list of paths, of which I copy the first three:
Error: Could not locate the bindings file. Tried:
→ /app/node_modules/sqlite3/build/node_sqlite3.node
→ /app/node_modules/sqlite3/build/Debug/node_sqlite3.node
→ /app/node_modules/sqlite3/build/Release/node_sqlite3.node
Which packages break without their install script?
The ones that download or compile their binary in the script break, and the ones that ship it inside the package keep working. I installed each one in an empty project with npm 12.2.3 and tried to load it:
| Package | Script npm blocks | Without the script | What to do |
|---|---|---|---|
bcrypt@5.1.1 |
install: node-pre-gyp install --fallback-to-build |
Cannot find module … bcrypt_lib.node |
Approve |
sqlite3@6.0.1 |
install: prebuild-install -r napi, with node-gyp rebuild as fallback |
Could not locate the bindings file |
Approve |
bcrypt@6.0.0 |
install: node-gyp-build |
Works: loads prebuilds/linux-arm64 |
Approve or deny |
argon2@0.45.2 |
install: cross-env ZERO_AR_DATE=1 node-gyp-build |
Works: ships prebuilds/linux-arm64 |
No approval needed |
esbuild@0.28.2 |
postinstall: node install.js |
Works: the API and npx esbuild --version |
Deny |
better-sqlite3@13.2.0 |
install: node-gyp rebuild (implicit) |
Works: ships prebuilds/linux-arm64.node |
Deny |
sharp@0.35.5 |
None | Works | Nothing |
sharp@0.35.5, electron@45.5.0 and @prisma/client@7.10.1 declare no install script, so they never show up in the warning. Prisma's Cannot find module '.prisma/client/default' error appeared the same on npm 11.20.0 and npm 12.2.3: allowScripts does not cause it, a missing prisma generate does.
puppeteer@25.18.1 does show up, with postinstall: node install.mjs. With the script blocked, ~/.cache/puppeteer was never created and launch() failed with Could not find Chrome (ver. 157.0.8103.78). After approving and rebuilding, the directory appeared, but on arm64 Linux Chrome still did not start, so I can only confirm the download half.
How to fix it: approve the script and rebuild
The fix is two commands: one records the approval and the other runs the script npm skipped. First review what is pending with npm install-scripts ls, which changes nothing. Then approve only what needs its script:
npm install-scripts ls
npm approve-scripts bcrypt sqlite3
npm rebuild bcrypt sqlite3
node -e 'console.log(require("bcrypt").hashSync("secret", 10).length)'
npm approve-scripts answered Approved bcrypt: added bcrypt@5.1.1 and npm rebuild finished with rebuilt dependencies successfully. The last command printed 60, the length of a bcrypt hash, and lib/binding/napi-v3/bcrypt_lib.node now existed. The approval lives in package.json, pinned to the installed version:
"allowScripts": {
"bcrypt@5.1.1": true,
"sqlite3@6.0.1": true
}
The order matters. I ran npm rebuild bcrypt before approving and it answered rebuilt dependencies successfully with exit code 0, without compiling anything. The only hint was a line reading npm warn rebuild 1 package had install scripts blocked. Approve first, rebuild second.
To make the warning go away for good, deny what does not need a script. npm install-scripts deny esbuild better-sqlite3 adds "esbuild": false and "better-sqlite3": false. After that, npm install-scripts ls answered No packages with unreviewed install scripts. and all five packages in the test project loaded.
How to fix it in Docker and in continuous integration
In a Dockerfile there is nothing to rebuild: commit the package.json with allowScripts and npm ci runs the approved scripts. Add --strict-allow-scripts so an unreviewed script stops the build:
FROM node:26-slim
RUN npm install -g npm@12.2.3
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev --strict-allow-scripts
COPY server.js .
CMD ["node", "server.js"]
With both approvals in package.json, this image built without the install-scripts warning and the container printed the hash length and the SQLite version. With the same Dockerfile and no allowScripts field, the docker build failed at the npm ci step with exit code 1:
npm error code ESTRICTALLOWSCRIPTS
npm error --strict-allow-scripts: 2 package(s) have install scripts
not covered by allowScripts:
npm error bcrypt@5.1.1 (install: (install scripts present))
npm error sqlite3@6.0.1 (install: (install scripts present))
npm error Approve them with `npm install-scripts approve`, deny them
with `npm install-scripts deny`, or bypass this check with
`--dangerously-allow-all-scripts`.
That is the failure you want: on the continuous integration (CI) server, with the package name in it, and not in production. Entries denied with false do not count towards this error.
Pin the npm version too, as in the example, instead of npm@latest. I make the same point for pnpm in the fix for unexpected argument '--frozen-lockfile' in pnpm 12. The guide to upgrading your Docker image to Node 26 covers the rest of the image.
Gotchas I ran into
The most expensive one was approving too much. npm approve-scripts --all approved all four pending packages, including better-sqlite3@13.2.0, which worked without a script thanks to its prebuilt binaries. With the approval in place, the next npm ci ran its node-gyp rebuild and failed with gyp ERR! find Python, because node:26-slim has neither Python nor a compiler. On failure npm removed the package, and require("better-sqlite3") stopped working.
That same package is missing from the npm install warning, but npm install-scripts ls and npm ci do list it. In my five-dependency project, npm install listed 3 blocked packages and npm ci listed 4. The difference is better-sqlite3, which declares no script: npm assigns it node-gyp rebuild because it ships a binding.gyp file. Always review with npm install-scripts ls before approving.
The approval expires with every version. I approved bcrypt@5.1.0, installed bcrypt@5.1.1, and the blocked warning came back, with "bcrypt@5.1.0": true still in package.json. npm install-scripts prune removes those orphaned entries. If you prefer to approve any future version, --no-allow-scripts-pin writes the bare name, at the cost of losing the per-version review.
In a project you cannot pass the list on the command line. npm ci --allow-scripts=bcrypt failed with npm error code EALLOWSCRIPTS, which I explain in the guide to allowScripts and min-release-age along with the security reasoning behind this whole change. A global install is the opposite: npm install -g bcrypt@5.1.1 blocked the script and only worked with --allow-scripts=bcrypt.
Alternatives if you cannot approve right now
There are three ways out that I tested, from most to least advisable:
- Staying on npm 11:
npm install -g npm@11installed npm 11.21.3, which warns and runs the scripts. It buys time, but the Node 27 alphas already bundle npm 12. allow-scripts=bcryptin the project.npmrc:npm ciran the bcrypt script without touchingpackage.json. It helps when you do not control that file.npm ci --dangerously-allow-all-scripts: it ran every script and bcrypt loaded. It restores the npm 11 behaviour and gives up the protection, so keep it for an emergency.
npm ci --ignore-scripts fixes nothing: it hides the warning and leaves the module as broken as before. And on a Node 20 image, npm install -g npm@latest does not even install npm 12: it fails with npm error code EBADENGINE, because npm 12.2.3 requires Node ^22.22.2 || ^24.15.0 || >=26.0.0.
FAQ
Is the not yet covered by allowScripts warning an error?
Not on npm 11: it is a warning, the script runs and the exit code is 0. On npm 12 the exit code is also 0, but the script does not run. Look at the verb: has install scripts not yet covered means it ran, and had install scripts blocked means it did not.
Do I have to approve esbuild or sharp?
Not in my tests. esbuild@0.28.2 worked without its postinstall, both the API and the binary, because the executable arrives in the optional package @esbuild/linux-arm64. sharp@0.35.5 declares no install script and gets its binaries the same way. Deny esbuild so it stops showing up in the warning.
Why does npm install exit 0 when my app does not start?
Because for npm 12 a blocked script is the intended behaviour, not a failure. Only --strict-allow-scripts turns it into an error, with the ESTRICTALLOWSCRIPTS code. Turn it on in CI with that flag or with strict-allow-scripts=true in .npmrc.
Conclusion
The npm 11 warning is a preview of what npm 12 already does: run no install script you have not approved. In my tests that broke bcrypt@5.1.1 and sqlite3@6.0.1, and left the five packages that ship a prebuilt binary untouched. Review with npm install-scripts ls, approve what compiles or downloads, deny the rest, and put --strict-allow-scripts in your Dockerfile before npm 12 reaches your base image.
Sources: [1] npm install-scripts, npm 12 documentation[1], [2] npm 12 config: allow-scripts and strict-allow-scripts[4], [3] npm 12.0.0 release notes[3], [4] npm changelog[5], [5] Node.js, index of published releases[2].
Sources
Source code
Access all the source code for this post on GitHub.
View on GitHub