Skip to content

[BUG] Installing dependencies of nested workspaces seems to not work properly in version 8.5+ #4774

Open

Description

@jansiegel

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

Current Behavior

In my repository, I have a nested workspace structure that looks something like this:

root/
├─ test-1/
│  ├─ test-1a/
│  │  ├─ package.json
│  ├─ test-1b/
│  │  ├─ package.json
│  ├─ package.json
├─ test-2/
│  ├─ package.json
├─ package.json
  1. ./package.json defines the directories test-1 and test-2 as workspaces
  2. ./test-1/package.json defines the directories test-1a and test-1b as workspaces
  3. These directories have their own dependencies:
    • ./test-1a
    • ./test-1b
    • ./test2

The problem: Running npm install in ./test-1 doesn't result in installing dependencies from test-1a and test-1b in ./test-1/node_modules. The only thing that happens is symlinking ./test-1 in ./node_modules.

Expected Behavior

In versions up to 8.4.x, running npm install in a nested workspace (directory with is both a workspace for a parent directory and defines its own workspaces) resulted in installing the dependencies from workspaces defined in its package.json to ./path-to-nested-workspace/node_modules.

Steps To Reproduce

I created a repo with the setup I'm explaining.

Either see a workflow that installs dependencies of a nested workspace for 3 different npm versions:

  1. https://github.com/jansiegel/nested-workspace-dependencies/actions/runs/2189924517

Or:

  1. Clone https://github.com/jansiegel/nested-workspace-dependencies
  2. Run npm install in the root directory
  3. cd test1
  4. npm install
  5. See what was installed

Environment

  • npm: 8.5.0+
  • Node.js: v16.14.2

Activity

  1. added
    Bugthing that needs fixing
    Needs Triageneeds review for next steps
    Release 8.xwork is associated with a specific npm 8 release
    on Apr 19, 2022
  2. agarwalvaibhav0211 commented on Jul 22, 2023

    @agarwalvaibhav0211

    Is there any ETA for this?

  3. ddubrava commented on Aug 22, 2023

    @ddubrava

    In my case, I can't even run scripts in the nested workspaces; npm says "no workspaces," although they are listed.

    root/
    ├─ moon/
    │  ├─ front/
    │  │  ├─ package.json
    │  ├─ package.json <-- npm run build -w front
    ├─ package.json
    
    {
      "name": "@moon/monorepo",
      "workspaces": [
        "front"
      ],
      "scripts": {
        "build": "npm run -w front build"
      }
    }
  4. ferferga commented on Jul 8, 2025

    @ferferga

    @wraithgar Sorry for the ping, but can this get assigned a priority please? It's the 11th most thumbed up issue and it looks like this is getting completely forgotten.

    PS: There are other issues with more upvotes than this one that are also labeled as "Needs triage"

  5. ferferga commented on Mar 19, 2026

    @ferferga

    @wraithgar @owlstronaut Please, at this point is almost mandatory to switch to pnpm due to the lacking support that npm gives to workspace setups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions