npm / npm/cli

[BUG] Regression on install algorithm since 7.20.2

Open
#3,724 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement Priority 2 Release 7.x
Dominant language
JavaScript
Stars
10.1k
Forks
4.7k
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Is there an existing issue for this?
  • I have searched the existing issues
Current Behavior

Given the following package.json :

{
    "devDependencies": {
        "@hug/eslint-config": "^3.1.2",
        "typescript": "~4.3.5"
    }
}

Running npm install produces:

# With npm 7.20.2
node_modules
├── @angular-eslint
│   └── builder
├── @hug
│   └── eslint-config
├── eslint-plugin-rxjs
├── eslint-plugin-rxjs-angular
└── ...

# With npm >= 7.20.3
node_modules
├── @hug
│   └── eslint-config
│       └── node_modules
│           ├── @angular-eslint
│           │   └── builder
│           ├── eslint-plugin-rxjs
│           ├── eslint-plugin-rxjs-angular
│           └── ...
└── ...

As explained in the documentation, the packages @angular-eslint, eslint-plugin-rxjs, eslint-plugin-rxjs-angular should be installed at the top-level, because they are only required by @hug/eslint-config and nowhere else.

This was still the case with npm@7.20.2 but after that version, packages are now installed privately for @hug/eslint-config without even being installed on the top-level.

This is causing me an issue as my angular project is expecting to find @angular-eslint/builder relatively from the root node_modules folder of my project.

Expected Behavior

I expect the install algorithm to work as described in the documentation and as it was working before.

Environment
  • OS: macOS Catalina (version 10.15.6)
  • Node: 14.17.5
  • npm: 7.22.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the npm install algorithm documentation and reproduce the package.json example using npm 7.20.2 and 7.22.0. Trace the install entry point responsible for dependency placement, then verify that @angular-eslint, eslint-plugin-rxjs, and eslint-plugin-rxjs-angular are installed at the project-level node_modules as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli, developer-experience
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.