Skip to content

npm 12 blocks bb-app's native-module install scripts by default: every install path (npm -g, npx, install.sh, self-update) yields a bb that cannot load better-sqlite3 / node-pty #1120

Closed

Description

@Joesirven

Workflow

Fresh install of the server on a Linux box and, separately, via the "Add machine" one-line installer on macOS — both using a clean Node 24 LTS install (npm 11.17.0, which ships with Node 24). No custom .npmrc existed on either machine.

What happened

npm install/npx bb-app@latest completed "successfully" but silently skipped the install/postinstall scripts for four packages that need native compilation:

npm warn allow-scripts 4 packages have install scripts not yet covered by allowScripts:
npm warn allow-scripts   @parcel/[email protected] (install: node scripts/build-from-source.js)
npm warn allow-scripts   [email protected] (install: prebuild-install || node-gyp rebuild --release)
npm warn allow-scripts   [email protected] (postinstall: node install.js)
npm warn allow-scripts   [email protected] (install: node scripts/prebuild.js || node-gyp rebuild; postinstall: node scripts/post-install.js)

npm 11 ships a default allow-scripts allowlist (empty by default: allow-scripts = [""]) that silently no-ops install scripts for packages not on the list, rather than failing the install. Since better-sqlite3 (the database driver) and the others never get their native bindings built/downloaded, this is the exact failure mode already documented in the README's troubleshooting section ("Could not locate the bindings file") — just from a newer root cause (npm's own new default) than the ignore-scripts=true cause that section currently documents.

Separately, on macOS the "Add machine" one-line installer failed a second way after this: npm installed bb-app, but its global bin directory is not on PATH (the installed bb/bb-app/bb-host-daemon/bb-server binaries land in the active Node version's global bin dir, e.g. ~/.nvm/versions/node/v24.19.0/bin/, which isn't necessarily on PATH in the non-login/non-interactive shell context the installer script runs in).

Expected

The install path (both the plain npx bb-app@latest flow and the /install.sh machine-join installer) should either:

  • pass --foreground-scripts/set npm_config_allow-scripts for its own known-safe native deps before installing, so a default npm 11 install doesn't silently produce a broken bb, or
  • detect the skipped-scripts warning and fail loudly with a pointer to the fix, instead of reporting success.

This will affect essentially every fresh install on a machine with npm 11+ (i.e. Node 22.19+/24+/26+, which is also what bb-app's own engines field requires) since the version ranges directly overlap.

Environment

  • bb-app 0.35.1
  • Node 24.19.0, npm 11.17.0 (both the bundled npm-11 default allow-scripts policy)
  • Reproduced on both Ubuntu 22.04 (server install) and macOS 26.3 Apple Silicon (add-machine install)

Activity

  1. added theissue type on Aug 7, 2026
  2. SawyerHood commented on Aug 7, 2026

    @SawyerHood
    Collaborator

    ty for the report. will make sure to fix this! maybe we can move off of better-sqlite to node:sqlite and remove the post install scripts entirely

  3. self-assigned this
    on Aug 8, 2026
  4. SawyerHood commented on Aug 8, 2026

    @SawyerHood
    Collaborator

    ⚠ Agent-generated: An AI agent ran this reproduction and drafted this
    reply. The npm debug logs quoted below are real output from that run. Please
    verify details before you act on them.

    Thanks for the detailed report, and for testing on two machines.

    I tried to reproduce this and could not. I think the allow-scripts warning is a
    red herring, but I also think you hit something real. I need a bit more from you
    to find it.

    What I tested

    Clean temporary HOME, no .npmrc, on two Node versions:

    • Node 24.18.0 with npm 11.17.0
    • Node 26.5.0 with npm 11.17.0

    I ran both npm install [email protected] and the npx bb-app@latest path.

    What I found

    npm printed the same four warnings you saw:

    npm warn allow-scripts 4 packages have install scripts not yet covered by allowScripts:
    npm warn allow-scripts   @parcel/[email protected] (install: node scripts/build-from-source.js)
    npm warn allow-scripts   [email protected] (install: prebuild-install || node-gyp rebuild --release)
    npm warn allow-scripts   [email protected] (postinstall: node install.js)
    npm warn allow-scripts   [email protected] (install: node scripts/prebuild.js || node-gyp rebuild; ...)
    

    But the npm debug log shows every one of those scripts ran and returned 0:

    info run @parcel/[email protected] install { code: 0, signal: null }
    info run [email protected] install { code: 0, signal: null }
    info run [email protected]        install { code: 0, signal: null }
    info run [email protected]        postinstall { code: 0, signal: null }
    info run [email protected]        postinstall { code: 0, signal: null }
    

    better_sqlite3.node and pty.node were both built and present afterward. The
    server started and loaded its plugins.

    So on npm 11.17.0 the warning is advisory. It reports that those packages have no
    review entry yet. It does not block them. An empty allow-scripts value creates
    no policy, so npm permits the scripts and then warns.

    What I need

    Your install clearly broke, so something else is going on. Can you send:

    1. The exact output of npm --version and node --version on the machine that
      broke.
    2. The exact install command you ran, including the npx or installer line for
      the macOS case.
    3. Whether these files exist in your install:
      • node_modules/better-sqlite3/build/Release/better_sqlite3.node
      • node_modules/node-pty/build/Release/pty.node
    4. The npm debug log from the broken install. It is under _logs/ in your npm
      cache directory. The info run ... lines are the ones that matter.
    5. The error you saw when bb failed to start.

    If your npm is a different patch than 11.17.0, that alone could explain the
    difference. This policy is new and its behavior has been changing.

  5. added
    desktop
    on Aug 18, 2026
  6. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/1120.html

    • Verdict: PARTIALLY REPRODUCED · root-cause confidence: high
    • Root cause (short): bb-app's native add-ons (better-sqlite3, node-pty) are only built by npm install scripts; npm 11's allowScripts policy is advisory (scripts still run, so the reporter's npm 11.17 mechanism is refuted), but npm 12 (registry latest since 2026-07-08) blocks unreviewed dependency scripts by default and, for -g/npx installs, ignores the package's own allowScripts, so every bb install path (npm -g, npx, install.sh, daemon self-update) that passes no --allow-scripts yields a bb that crashes with "Could not locate the bindings file" / "Failed to load native module: pty.node"; the PATH sub-issue was already fixed by Fix machine installation reliability and feedback #1419.
    • Proposed fix: Add --allow-scripts=better-sqlite3,node-pty,@parcel/watcher to both npm install -g lines in apps/server/src/assets/install-machine.sh and to the self-updater argv in apps/host-daemon/src/protocol-self-update.ts (defaultInstallTarball); verified end to end (author and independent verifier) that this makes the npm 12.0.2 machine join succeed, that npm 11 accepts the flag and npm 10.9.9 ignores it (in -g --prefix flag and env-var forms). After npm install, verify require(better-sqlite3)/require(node-pty) load and fail the installer loudly with a pointer to --allow-scripts / ignore-scripts (…
    • Caveats: Revision addressed all verifier findings: the npm 11.17.0 control was re-run on a fresh port (39901) with the fixed 1120-install-matrix.sh (busy-port refusal, setsid + process-group kill, still-listening check) and npm11.17.out plus the HTML paste were replaced with a clean run (bb-server exit 143, port released, HTTP 200 from that install's own server); package.json permalink corrected to L68-L77…

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at 16ceb3a54, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by Claude Opus 5

  7. added
    partial-repro
    on Aug 18, 2026
  8. changed the title [-]Fresh install silently breaks native modules under npm 11's default allow-scripts policy[/-] [+]npm 12 blocks bb-app's native-module install scripts by default: every install path (npm -g, npx, install.sh, self-update) yields a bb that cannot load better-sqlite3 / node-pty[/+] on Aug 18, 2026
  9. SawyerHood commented on Aug 18, 2026

    @SawyerHood
    Collaborator

    Retitled to match what reproduced (https://get-bb.github.io/reports/issues/1120.html). On npm 11.16/11.17 the allowScripts policy is advisory — the install scripts still run and bb starts, so the original mechanism does not hold. On npm 12.0.x (registry latest since 2026-07-08) unreviewed dependency scripts are blocked by default and, for -g/npx installs, the package's own allowScripts is ignored, so every bb install path produces "Could not locate the bindings file" / "Failed to load native module: pty.node". Fix verified end to end: pass --allow-scripts=better-sqlite3,node-pty,@parcel/watcher in install-machine.sh and the self-updater argv (npm 11 accepts it, npm 10 ignores it), and document the npx --allow-scripts=… form.

    AGENT GENERATED: by Claude Opus 5

  10. added
    confirmed-repro
    and removed
    partial-repro
    on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

confirmed-reprodesktop

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions