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 [email protected] does not satisfy [email protected]
npm error Missing: [email protected] from lock file
npm error Missing: [email protected] from lock file
npm error Invalid: lock file's [email protected] does not satisfy [email protected]
npm error Missing: [email protected] from lock file
npm error Missing: [email protected] 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 [email protected] does not satisfy [email protected]
npm error Missing: [email protected] from lock file
npm error Missing: [email protected] from lock file
npm error Invalid: lock file's [email protected] does not satisfy [email protected]
npm error Missing: [email protected] from lock file
npm error Missing: [email protected] from lock file

<snip>

# npm ls chokidar
PROJECT@ /Users/USER/_code/path
├─┬ @angular/[email protected]
│ └─┬ [email protected]
│   └── [email protected]
├─┬ @angular/[email protected]
│ └─┬ @angular-devkit/[email protected]
│   └── [email protected] deduped invalid: "^3.5.2" from node_modules/@angular-devkit/core
├─┬ @angular/[email protected]
│ └── [email protected] invalid: "^3.5.2" from node_modules/@angular-devkit/core
├─┬ @cust/[email protected]
│ └─┬ [email protected]
│   └─┬ @angular-devkit/[email protected]
│     └─┬ @angular-devkit/[email protected]
│       └── [email protected]
└─┬ [email protected]
  └─┬ @angular-devkit/[email protected]
    └─┬ [email protected]
      └── [email protected]

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/[email protected]
│ └─┬ [email protected]
│   └── [email protected]
├─┬ @angular/[email protected]
│ └─┬ @angular-devkit/[email protected]
│   └── [email protected] deduped
├─┬ @angular/[email protected]
│ └── [email protected]
├─┬ @cust/[email protected]
│ └─┬ [email protected]
│   └─┬ @angular-devkit/[email protected]
│     └─┬ @angular-devkit/[email protected]
│       └── [email protected] deduped
└─┬ [email protected]
  └─┬ @angular-devkit/[email protected]
    └─┬ [email protected]
      └── [email protected] 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