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

expo-doctor using a pre-release version of react-native-svg causing strict peer dependencies to fail #28696

Closed
seanblonien opened this issue May 8, 2024 · 2 comments
Labels
CLI Versioned Expo CLI -- `npx expo start`

Comments

@seanblonien
Copy link

seanblonien commented May 8, 2024

Summary

NPM install is failing after running expo-doctor due to irreconcilable react-native-svg version pinning caused by expo-doctor, even though the 3rd party dependency involved does specify a valid dependency constraint.

What platform(s) does this occur on?

Android, iOS, Web

SDK Version

51

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.13.0 - ~/.nvm/versions/node/v20.13.0/bin/node
npm: 10.5.0 - ~/git/fly-fit/node_modules/.bin/npm
Watchman: 2024.05.06.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
IDEs:
Android Studio: 2023.3 AI-233.14808.21.2331.11709847
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: ^51.0.0 => 51.0.0
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
react-native-web: ~0.19.10 => 0.19.10
npmGlobalPackages:
eas-cli: 9.0.0
Expo Workflow: bare

Minimal reproducible example

When upgrading the Expo 51 from Expo 51, when I ran the
npx expo install --fix
command, it upgraded react-native-svg@15.2.0-rc.0 in my package.json and package-lock.json (previous version was react-native-svg@14.1.0

One of my other dependencies (react-native-circular-progress-indicator) specifies react-native-svg@">=12.1.1" as a peer dependency. When I run a simple npm install where my .npmrc file has these flags set:

strict-peer-deps=true

I get the following error

npm i

npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: react-native-circular-progress-indicator@4.4.2
npm error Found: react-native-svg@15.2.0-rc.0
npm error node_modules/react-native-svg
npm error   react-native-svg@"15.2.0-rc.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react-native-svg@">=12.1.1" from react-native-circular-progress-indicator@4.4.2
npm error node_modules/react-native-circular-progress-indicator
npm error   react-native-circular-progress-indicator@"^4.4.2" from the root project
npm error
npm error Conflicting peer dependency: react-native-svg@15.2.0
npm error node_modules/react-native-svg
npm error   peer react-native-svg@">=12.1.1" from react-native-circular-progress-indicator@4.4.2
npm error   node_modules/react-native-circular-progress-indicator
npm error     react-native-circular-progress-indicator@"^4.4.2" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see: ...

Very simply, an "rc" version within npm versioning constraints DOES NOT satisfy this ">=12.1.1" constraint since it's a pre-release version. The simple fix would be to have expo-doctor NOT to install an "rc" version. Just seems like a bug or oversight somewhere in the expo-doctor since the 3rd party dependency just expects any version ">=12" the version pinned is invalid.

@seanblonien seanblonien added CLI Versioned Expo CLI -- `npx expo start` needs validation Issue needs to be validated labels May 8, 2024
@expo-bot expo-bot removed the needs validation Issue needs to be validated label May 8, 2024
@seanblonien
Copy link
Author

seanblonien commented May 9, 2024

Removing the dependency from the package.json "dependencies" list actually resolved the issue, and the package-lock.json installed that dependency transitively and did successfully resolve react-native-svg@15.2.0 which satisfied strict peer dependency rules

so that is the temporary fix, don't list react-native-svg in your dependency list, but still feels like a weird bug that expo-doctor has when it is listed

@brentvatne
Copy link
Member

we recommend react-native-svg@15.2.0 now. package managers can be tricky to work with sometimes, i personally think that the behavior of npm to not consider 15.2.0-rc.0 as >=12.1.1 is incorrect but npm folks disagree. npm/npm#8854

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Versioned Expo CLI -- `npx expo start`
Projects
None yet
Development

No branches or pull requests

3 participants