npm / npm/cli

[BUG] Incorrect detection of install script for `better-sqlite3@13.0.2`?

Open
#9,837 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

allowScripts Bug Needs Triage
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
This issue exists in the latest npm version
  • I am using the latest npm
This is not just a request to bump a dependency for a CVE
  • This is not solely a request to bump a dependency for a CVE
Current Behavior

I'm seeing an unexpected warning about a better-sqlite@13.0.2 having an install script.

added 2 packages, and audited 3 packages in 342ms

found 0 vulnerabilities
npm warn install-scripts 1 package had install scripts blocked because they are not covered by allowScripts:
npm warn install-scripts   better-sqlite3@13.0.2 (install: node-gyp rebuild)
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.
Expected Behavior

While better-sqlite3 uses node-gyp, the automatic creation of an install script when publishing is disabled by the inclusion of the gypfile: false option in its package.json. See https://github.com/WiseLibs/better-sqlite3/issues/1503 and https://github.com/WiseLibs/better-sqlite3/pull/1505.

I'm not seeing any indication of an install script for this version of better-sqlite3 in the packument API response: https://registry.npmjs.com/better-sqlite3.

The expectation is that there's no warning at all when installing better-sqlite3@13.0.2.

Steps To Reproduce

Create a project with the following package.json:

{
  "type": "module",
  "dependencies": {
    "better-sqlite3": "13.0.2"
  }
}

Run npm install

Environment
  • npm: 12.0.2
  • Node.js: 24.18.0
  • OS Name: macOS 26.5.2 (Tahoe)
  • System Model Name: MacBook Air M5
  • npm config:
; node bin location = /Users/andrewchou/.local/share/mise/installs/node/24.18.0/bin/node
; node version = v24.18.0
; npm local prefix = /Users/andrewchou/code/github/achou11/npm-allow-scripts-issue-repro
; npm version = 12.0.2
; cwd = /Users/andrewchou/code/github/achou11/npm-allow-scripts-issue-repro
; HOME = /Users/andrewchou
; Run `npm config ls -l` to show all defaults

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the provided package.json and npm install command, then compare the better-sqlite3@13.0.2 packument response with npm's install-script detection. Trace the npm install entry point and existing tests for blocked install scripts. Done means the package installs without an install-scripts warning and regression coverage protects that behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.