Skip to content

npm v7 does not install linked packages dependencies #2339

@garciaalvaro

Description

@garciaalvaro

Current Behavior:

npm v7 does not install linked local packages dependencies.

Expected Behavior:

In npm v6 the dependencies of a local linked package are installed. This means that if app has my-local-pkg as a dependency, running npm install generates app/node_modules folder and also my-local-pkg/node_modules (with its dependencies).
In npm v7, however, only app/node_modules is generated.

Steps To Reproduce:

I created the following repository to illustrate it. The README.md has the instructions on how to reproduce it.
Simplified, the steps are:

  1. Add the following folder structure: ./app and ./my-local-pkg, each with their own package.json
  2. Include this in the ./app/package.json:
{
  "name": "app",
  "dependencies": {
    "my-local-pkg": "file:../my-local-pkg",
    "prettier": "^2.2.1"
  }
}
  1. Include this in the ./my-local-pkg/package.json:
{
  "name": "my-local-pkg",
  "dependencies": {
    "typescript": "^4.1.3"
  }
}
  1. Go to ./app and run npm install.
    npm version 6 produces:
node_modules
	.bin
	my-local-pkg
		node_modules
			typescript
	prettier

while npm version 7 produces:

node_modules
	.bin
	my-local-pkg
	prettier

Compare the two outputs, npm v7 does not install my-local-pkg dependencies, there is no ./my-local-pkg/node_modules folder generated.

Environment:

npm v7.1.2

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingEnhancementnew feature or improvementPriority 1high priority issueRelease 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