Skip to content

[BUG] npm7 does not create transitive node_module folders for dependencies referenced via file:/ #2145

Closed as not planned

Description

@mattem

I've searched release notes, however I was unable to see if this was an intended breaking change.

Current Behavior:

When referencing a dependency via file:../path/to/dep, [email protected] does not install or create the transitive node_modules folder for dep

Expected Behavior:

[email protected] will create and install the node_modules folder for the referenced dependency

Steps To Reproduce:

mkdir a b

// create the package.json files with dependencies
cat << EOF > b/package.json
{
  "name": "b",
  "version": "1.0.0",
  "dependencies": {
    "lodash": "^4.17.20"
  }
}
EOF

cat << EOF > a/package.json
{
  "name": "a",
  "version": "1.0.0",
  "dependencies": {
    "b": "file:../b"
  }
}
EOF

// create a lock file for b
cd b
npm install --package-lock-only

// install for a, creating lock file and node_modules
cd ../a
npm install

a/node_modules will contain the symlink to ../../b, but with no node_modules for b

Environment:

npm@7:

  • OS: MacOS 10.14.4
  • Node: v15.0.1
  • npm: v7.0.9

npm@6:

  • OS: MacOS 10.14.4
  • Node: v12.13.0
  • npm: v6.12.0

Activity

  1. added
    Bug
    Needs Triage
    Release 7.x
    on Nov 7, 2020
  2. added and removed
    Needs Triage
    on Jan 22, 2021
  3. darcyclarke commented on Jan 22, 2021

    @darcyclarke
    Contributor

    @mattem we are aware of this as a breaking change between v6 & v7 - we're going to consider this as a larger topic as to whether to change back this behavior in the next Open RFC call. As a point of reference, linked deps that are a child of the root will actually be installed fully, whereas if they're linked outside they aren't today (again, as you've seen).

    I'll circle back on this when we have an update from the call next Wednesday

  4. self-assigned this
    on Jan 22, 2021
  5. added
    Priority 2
    and removed on Feb 3, 2021
  6. removed their assignment
    on Feb 24, 2021
  7. nkolev92 commented on Oct 27, 2026

    @nkolev92
    Contributor

    Thank you for reporting this issue.
    At this point, this issue is either for a CLI version no longer actively maintained or just a lower priority.
    If you believe this to be incorrect, please file a new issue and we'll take a look.

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

    BugPriority 2Release 7.x

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions