Skip to content

[BUG] install-strategy=linked: a workspace inside another workspace's folder gets no dependencies installed #10082

Open

Description

@glen-84

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

Take a root whose workspaces lists a folder and a workspace inside that folder, ["packages/outer", "packages/outer/src/*"]. With install-strategy=linked, npm installs nothing for the inner workspace. packages/outer/src/inner/node_modules is never created, so the inner workspace cannot resolve its own dependencies, and npm install reports up to date without fetching them. npm ls --all reports the workspace as UNMET DEPENDENCY / missing: inner@file:…, required by root@1.0.0 and exits 1, and npm ls --workspaces leaves it out.

npm ci from a lockfile generated with --install-strategy=hoisted (which records the inner workspace's dependencies) gives the same result. With install-strategy=hoisted, everything works.

Related, but not the same:

Expected Behavior

The inner workspace's dependencies are installed and resolvable from it, and npm ls lists the workspace like any other, matching install-strategy=hoisted.

Steps To Reproduce

cd "$(mktemp -d)"
mkdir -p packages/outer/src/inner
echo '{"name":"root","version":"1.0.0","workspaces":["packages/outer","packages/outer/src/*"]}' > package.json
echo '{"name":"outer","version":"1.0.0"}' > packages/outer/package.json
echo '{"name":"inner","version":"1.0.0","dependencies":{"is-number":"7.0.0"}}' > packages/outer/src/inner/package.json
echo 'install-strategy=linked' > .npmrc
npm install --no-audit --no-fund
# up to date in 128ms

ls packages/outer/src/inner/node_modules
# ls: cannot access 'packages/outer/src/inner/node_modules': No such file or directory

(cd packages/outer/src/inner && node -e "require.resolve('is-number')")
# Error: Cannot find module 'is-number'

npm ls --all
# root@1.0.0 <dir>
# ├── UNMET DEPENDENCY inner@file:<dir>/packages/outer/src/inner
# └── outer@1.0.0 -> ./packages/outer
# npm error code ELSPROBLEMS
# npm error missing: inner@file:<dir>/packages/outer/src/inner, required by root@1.0.0

With install-strategy=hoisted in .npmrc instead, is-number resolves from the inner workspace, and npm ls --all prints inner@1.0.0 -> ./packages/outer/src/inner and exits 0.

Environment

  • npm: 12.2.0 (also reproduced on 11.19.0)
  • Node.js: v24.21.0
  • OS Name: Ubuntu 26.04.1 LTS
  • System Model Name: not hardware-specific
  • npm config:
; "project" config from <dir>/.npmrc

install-strategy = "linked"

Drafted by Claude (Anthropic AI assistant).

Activity

  1. drewmt commented on Oct 5, 2026

    @drewmt

    Thanks for the clear reproduction. I opened #10083 to include nested filesystem children in linked installs and actual-tree loading, with regression coverage for dependency resolution and workspace visibility. The full Arborist suite passes.

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