Skip to content

[BUG] Workspace lifecycle scripts silently skipped under install-strategy=linked #9982

Open

Description

@manzoorwanijk

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

With install-strategy=linked, npm install does not run a workspace's preinstall, install, postinstall or prepare scripts. Nothing is logged, the unreviewed scripts advisory does not list the workspace, and --strict-allow-scripts still exits 0. Hoisted on npm 12 and linked on npm 11.19.1 run all four.

Expected Behavior

Workspace scripts run under linked, as they do under hoisted, since workspaces are exempt from the allowScripts gate.

Steps To Reproduce

mkdir x && cd x
mkdir -p packages/a
echo '{"name":"r","version":"1.0.0","workspaces":["packages/*"]}' > package.json
echo '{"name":"a","version":"1.0.0","scripts":{"postinstall":"touch post.txt","prepare":"touch prepared.txt"}}' > packages/a/package.json
npm install --install-strategy=linked --no-audit --no-fund
ls packages/a   # expected: package.json post.txt prepared.txt, actual: package.json

Environment

  • npm: 12.0.2 and latest (c9876d7)
  • Node.js: v24.18.0
  • OS Name: macOS Darwin 25.6.0

Activity

  1. saitanallensantiago26-beep commented on Sep 15, 2026

    @saitanallensantiago26-beep

    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

    With install-strategy=linked, npm install does not run a workspace's preinstall, install, postinstall or prepare scripts. Nothing is logged, the unreviewed scripts advisory does not list the workspace, and --strict-allow-scripts still exits 0. Hoisted on npm 12 and linked on npm 11.19.1 run all four.

    Expected Behavior

    Workspace scripts run under linked, as they do under hoisted, since workspaces are exempt from the allowScripts gate.

    Steps To Reproduce

    mkdir x && cd x
    mkdir -p packages/a
    echo '{"name":"r","version":"1.0.0","workspaces":["packages/*"]}' > package.json
    echo '{"name":"a","version":"1.0.0","scripts":{"postinstall":"touch post.txt","prepare":"touch prepared.txt"}}' > packages/a/package.json
    npm install --install-strategy=linked --no-audit --no-fund
    ls packages/a   # expected: package.json post.txt prepared.txt, actual: package.json

    Environment

    • npm: 12.0.2 and latest (c9876d7)
    • Node.js: v24.18.0
    • OS Name: macOS Darwin 25.6.0
  2. saitanallensantiago26-beep commented on Sep 15, 2026

    @saitanallensantiago26-beep

    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

    With install-strategy=linked, npm install does not run a workspace's preinstall, install, postinstall or prepare scripts. Nothing is logged, the unreviewed scripts advisory does not list the workspace, and --strict-allow-scripts still exits 0. Hoisted on npm 12 and linked on npm 11.19.1 run all four.

    Expected Behavior

    Workspace scripts run under linked, as they do under hoisted, since workspaces are exempt from the allowScripts gate.

    Steps To Reproduce

    mkdir x && cd x
    mkdir -p packages/a
    echo '{"name":"r","version":"1.0.0","workspaces":["packages/*"]}' > package.json
    echo '{"name":"a","version":"1.0.0","scripts":{"postinstall":"touch post.txt","prepare":"touch prepared.txt"}}' > packages/a/package.json
    npm install --install-strategy=linked --no-audit --no-fund
    ls packages/a   # expected: package.json post.txt prepared.txt, actual: package.json

    Environment

    • npm: 12.0.2 and latest (c9876d7)
    • Node.js: v24.18.0
    • OS Name: macOS Darwin 25.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions