Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] npm dedupe step fails, a additional "npm i" run fixes the issue #7847

Closed
2 tasks done
neophob opened this issue Oct 17, 2024 · 2 comments
Closed
2 tasks done

[BUG] npm dedupe step fails, a additional "npm i" run fixes the issue #7847

neophob opened this issue Oct 17, 2024 · 2 comments
Labels
Bug thing that needs fixing Duplicate duplicate of another, existing issue

Comments

@neophob
Copy link

neophob commented Oct 17, 2024

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

  • run npm i on a clean project (no package-lock.json file, no node_modules directory)
  • npm should generate a package-lock.json file that can be used with npm ci
  • in my case this is not the case as there is an issue with a deduped version
# rm -rf ./node_modules
# rm package-lock.json 
# npm i

added 1930 packages, and audited 1931 packages in 3m

<snip>

# npm ci
npm error code EUSAGE
npm error
npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm error
npm error Invalid: lock file's chokidar@4.0.1 does not satisfy chokidar@3.6.0
npm error Missing: chokidar@4.0.1 from lock file
npm error Missing: glob-parent@5.1.2 from lock file
npm error Invalid: lock file's readdirp@4.0.2 does not satisfy readdirp@3.6.0
npm error Missing: picomatch@2.3.1 from lock file
npm error Missing: readdirp@4.0.2 from lock file
npm error code EUSAGE
npm error
npm error `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
npm error
npm error Invalid: lock file's chokidar@4.0.1 does not satisfy chokidar@3.6.0
npm error Missing: chokidar@4.0.1 from lock file
npm error Missing: glob-parent@5.1.2 from lock file
npm error Invalid: lock file's readdirp@4.0.2 does not satisfy readdirp@3.6.0
npm error Missing: picomatch@2.3.1 from lock file
npm error Missing: readdirp@4.0.2 from lock file

<snip>

# npm ls chokidar
PROJECT@ /Users/USER/_code/path
├─┬ @angular/build@18.2.9
│ └─┬ sass@1.77.6
│   └── chokidar@3.6.0
├─┬ @angular/cli@18.2.9
│ └─┬ @angular-devkit/core@18.2.9
│   └── chokidar@4.0.1 deduped invalid: "^3.5.2" from node_modules/@angular-devkit/core
├─┬ @angular/compiler-cli@18.2.8
│ └── chokidar@4.0.1 invalid: "^3.5.2" from node_modules/@angular-devkit/core
├─┬ @cust/eslint-plugin@2.14.0
│ └─┬ eslint-plugin-ngrx@2.1.4
│   └─┬ @angular-devkit/schematics@13.3.11
│     └─┬ @angular-devkit/core@13.3.11
│       └── chokidar@3.6.0
└─┬ jest-preset-angular@14.2.4
  └─┬ @angular-devkit/build-angular@18.2.9
    └─┬ webpack-dev-server@5.0.4
      └── chokidar@3.6.0

Now if I run npm i again, this will fix the issue:

# npm i 

added 4 packages, removed 12 packages, changed 2 packages, and audited 1923 packages in 3s

# npm ls chokidar
PROJECT@ /Users/USER/_code/path
├─┬ @angular/build@18.2.9
│ └─┬ sass@1.77.6
│   └── chokidar@3.6.0
├─┬ @angular/cli@18.2.9
│ └─┬ @angular-devkit/core@18.2.9
│   └── chokidar@3.6.0 deduped
├─┬ @angular/compiler-cli@18.2.8
│ └── chokidar@4.0.1
├─┬ @cust/eslint-plugin@2.14.0
│ └─┬ eslint-plugin-ngrx@2.1.4
│   └─┬ @angular-devkit/schematics@13.3.11
│     └─┬ @angular-devkit/core@13.3.11
│       └── chokidar@3.6.0 deduped
└─┬ jest-preset-angular@14.2.4
  └─┬ @angular-devkit/build-angular@18.2.9
    └─┬ webpack-dev-server@5.0.4
      └── chokidar@3.6.0 deduped


Expected Behavior

npm i builds a proper lock file in the first run ;)

Steps To Reproduce

  • see package.json in the first comment below
  • run npm i then npm ci to see the error

Environment

  • npm: 10.8.2
  • Node.js: 20.18.0
  • OS Name: OSX
  • System Model Name:
  • npm config:
; copy and paste output from `npm config ls` here
@neophob neophob added Bug thing that needs fixing Needs Triage needs review for next steps labels Oct 17, 2024
@neophob
Copy link
Author

neophob commented Oct 17, 2024

package.json

You should be able to reproduce the error with this package.json

@milaninfy
Copy link
Contributor

Closing: this looks to be similar if not a duplicate of an existing issue, #6787. If you believe your instance is unique, please provide further clarifying details.

@milaninfy milaninfy closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
@milaninfy milaninfy added Duplicate duplicate of another, existing issue and removed Needs Triage needs review for next steps labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Duplicate duplicate of another, existing issue
Projects
None yet
Development

No branches or pull requests

2 participants