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

npm install fails with upstream dependency conflict (workaround: npm install --force) #124

Open
rewbs opened this issue Jun 7, 2023 · 2 comments

Comments

@rewbs
Copy link
Owner

rewbs commented Jun 7, 2023

npm install currently fails due to incompatibilities in transitive dependencies. This is harmless at the moment and can be worked around with npm install --force. However, that command is somewhat dangerous so it would be better to not rely on it.

The problems are that:

The error output is:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/typescript
npm ERR!   typescript@"^5.0.4" from the root project
npm ERR!   peer typescript@">= 2.7" from [email protected]
npm ERR!   node_modules/fork-ts-checker-webpack-plugin
npm ERR!     fork-ts-checker-webpack-plugin@"^6.5.0" from [email protected]
npm ERR!     node_modules/react-dev-utils
npm ERR!       react-dev-utils@"^12.0.1" from [email protected]
npm ERR!       node_modules/react-scripts
npm ERR!         react-scripts@"5.0.1" from the root project
npm ERR!   2 more (ts-jest, tsutils)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional typescript@"^3.2.1 || ^4" from [email protected]
npm ERR! node_modules/react-scripts
npm ERR!   react-scripts@"5.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/typescript
npm ERR!   peerOptional typescript@"^3.2.1 || ^4" from [email protected]
npm ERR!   node_modules/react-scripts
npm ERR!     react-scripts@"5.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

Once again, the workaround is simply npm install --force.

@rewbs
Copy link
Owner Author

rewbs commented Jun 7, 2023

Turns out adding the following is enough to mute the error for react-scripts, and @xzdarcy/[email protected] only flags a warning:

  "overrides": {
    "react-scripts": {
      "typescript": "^5"
    }

So we can now run without --force with the only downside being a warning. The importance of this issue is therefore much lower.

@conorluddy
Copy link
Contributor

Just to add a tip - you can also use the $ approach like this to make it match the version of the package from your main deps 👍🏼

"overrides": {
    "react-scripts": {
      "typescript": "$typescript"
    }
}

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

No branches or pull requests

2 participants