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

Updating dependencies fails when an override is specified #1332

Open
3 tasks done
ErikBrendel opened this issue Sep 13, 2023 · 1 comment
Open
3 tasks done

Updating dependencies fails when an override is specified #1332

ErikBrendel opened this issue Sep 13, 2023 · 1 comment
Labels

Comments

@ErikBrendel
Copy link

  • I have searched for similar issues
  • I am using the latest version of npm-check-updates
  • I am using node >= 14.14

Steps to Reproduce

  • have a package defined as dependency and as override (useful when some other dependencies have an unnecessary hard constraint and we want to deduplicate the dependency tree)
  • use npx -y npm-check-updates --interactive and press enter twice (updating this dependency and installing the changes)
{
  "name": "example",
  "dependencies": {
    "typescript": "^5.1.6"
  },
  "overrides": {
    "typescript": "^5.1.6"
  }
}

Current behavior

Only the dep is updated, and not the override, leading to this error output:

✔ Choose which packages to update › 

 typescript  ^5.1.6  →  ^5.2.2

✔ Run npm install to install new versions? … yes
Installing dependencies...
npm
 ERR! code EOVERRIDE

npm ERR! Override for typescript@^5.2.2 conflicts with direct dependency

Desired behavior

In these cases where the dependency and the override are equal, the dependency and override should be updated in sync, so that the installation then works.

raineorshine added a commit that referenced this issue Sep 13, 2023
@raineorshine
Copy link
Owner

raineorshine commented Sep 13, 2023

Fixed in v16.14.2. Thanks!


FYI: In researching the problem, I came across this recommendation in the official npm docs (emphasis mine):

You may not set an override for a package that you directly depend on unless both the dependency and the override itself share the exact same spec. To make this limitation easier to deal with, overrides may also be defined as a reference to a spec for a direct dependency by prefixing the name of the package you wish the version to match with a $.

{
  "name": "example",
  "dependencies": {
    "typescript": "^5.1.6"
  },
  "overrides": {
    "typescript": "$typescript"
  }
}

https://docs.npmjs.com/cli/v8/configuring-npm/package-json#overrides

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants