expo / expo-cli

Tools for creating, running, and deploying universal Expo and React Native apps
https://docs.expo.io/workflow/expo-cli/
2.61k stars 477 forks source link

`npx install-expo-modules` giving error after running `yarn add expo@>=44.0.0-* <45.0.0`. Error is `Error: expo@>=44.0.0-* <45.0.0 isn't supported by any available resolver`. I assume the error is related to yarn. #4125

Closed jaquinocode closed 2 years ago

jaquinocode commented 2 years ago

Summary

What I did

I have a React Native project (a project created with the react native cli). This project does not have unimodules or the expo package or anything like that. It's just a React Native project created with the react native cli.

I ran npx install-expo-modules in the project root.

What I expected

For the command to succeed.

What actually happened

I got an error. (See the error message I copy-pasted.) The error to me clearly seems due to a yarn error. (Read the comment reply to this post to see what I'm talking about.)

I also assume this is due to yarn because I'm using the new yarn (yarn berry), not yarn classic. And I know that the new yarn is typically not used in React Native projects right now. But who knows, maybe the problem happens on yarn classic too.

Environment

Expo CLI 5.0.3 environment info:
    System:
      OS: macOS 11.5.2
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.18.2 - ~/.nvm/versions/node/v14.18.2/bin/node
      Yarn: 3.0.2 - ~/.yarn/bin/yarn
      npm: 8.3.0 - ~/.nvm/versions/node/v14.18.2/bin/npm
      Watchman: 2022.01.03.00 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.11.2 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
      Android SDK:
        API Levels: 29, 30
        Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3
        System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 4.2 AI-202.7660.26.42.7486908
      Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
    npmPackages:
      react: ^17.0.2 => 17.0.2 
      react-dom: ^17.0.2 => 17.0.2 
      react-native: ^0.65.1 => 0.65.2 
      react-native-web: ^0.17.1 => 0.17.5 
    npmGlobalPackages:
      expo-cli: 5.0.3
    Expo Workflow: bare

Please specify your device/emulator/simulator platform, model and version

N/A

Error output

ja@mac:~/code/react-native/projects/copper/@app/mobile$ EXPO_DEBUG=true npx install-expo-modules
✔ Expo modules minimum iOS requirement is 12.0. This tool will change your iOS deployment target to 12.0. Do you want to continue? … yes
› Updating your project...
android.mainApplication: withDefaultBaseMods ➜ withAndroidBaseMods ➜ withGeneratedBaseMods ➜ withAndroidMainApplicationBaseMod
android.mainApplication: 
android.mainActivity: withDefaultBaseMods ➜ withAndroidBaseMods ➜ withGeneratedBaseMods ➜ withAndroidMainActivityBaseMod
android.mainActivity: 
android.settingsGradle: withDefaultBaseMods ➜ withAndroidBaseMods ➜ withGeneratedBaseMods ➜ withAndroidSettingsGradleBaseMod
android.settingsGradle: 
ios.dangerous: withDefaultBaseMods ➜ withIosBaseMods ➜ withGeneratedBaseMods ➜ withIosDangerousBaseMod
ios.dangerous: 
ios.dangerous: 
ios.dangerous: 
ios.dangerous: 
ios.xcodeproj: withDefaultBaseMods ➜ withIosBaseMods ➜ withGeneratedBaseMods ➜ withIosXcodeprojBaseMod
ios.xcodeproj: 
ios.appDelegate: withDefaultBaseMods ➜ withIosBaseMods ➜ withGeneratedBaseMods ➜ withIosAppDelegateBaseMod
ios.appDelegate: 
› Installing expo packages...
> yarn add expo@>=44.0.0-* <45.0.0
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: expo@>=44.0.0-* <45.0.0 isn't supported by any available resolver
    at Xc.getResolverByDescriptor (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:294:5330)
    at Xc.bindDescriptor (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:294:4719)
    at p (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:303:6959)
    at async Promise.all (index 6)
    at async Fe.resolveEverything (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:303:8166)
    at async /Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:306:2135
    at async xe.startTimerPromise (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:275:3730)
    at async Fe.install (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:306:2074)
    at async /Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:311:122
    at async Function.start (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:275:2287)
➤ YN0000: └ Completed in 0s 218ms
➤ YN0000: Failed with errors in 0s 224ms
Uncaught Error Error: yarnpkg exited with non-zero code: 1
    at ChildProcess.m (/Users/ja/.npm/_npx/d80a5a2fd0b43bdc/node_modules/install-expo-modules/build/index.js:2:18918)
    at Object.onceWrapper (events.js:520:26)
    at ChildProcess.emit (events.js:400:28)
    at maybeClose (internal/child_process.js:1058:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
    ...
    at Object.spawnAsync [as default] (/Users/ja/.npm/_npx/d80a5a2fd0b43bdc/node_modules/install-expo-modules/build/index.js:2:18403)
    at YarnPackageManager._runAsync (/Users/ja/.npm/_npx/d80a5a2fd0b43bdc/node_modules/install-expo-modules/build/index.js:2:1400291)
    at YarnPackageManager.addAsync (/Users/ja/.npm/_npx/d80a5a2fd0b43bdc/node_modules/install-expo-modules/build/index.js:2:1399307)
    at async runAsync (/Users/ja/.npm/_npx/d80a5a2fd0b43bdc/node_modules/install-expo-modules/build/index.js:2:1441645)
    at async /Users/ja/.npm/_npx/d80a5a2fd0b43bdc/node_modules/install-expo-modules/build/index.js:2:1441934 {
  pid: 78893,
  output: [ '', '' ],
  stdout: '',
  stderr: '',
  status: 1,
  signal: null
}

Reproducible demo or steps to reproduce from a blank project

I can't share my project as it's part of the company I work for so I can't give exact code to reproduce.

However, seeing as I assume this is a problem with using the latest yarn (yarn berry), you can try to reproduce this yourself:

But maybe this error happens using classic yarn too. I wouldn't know since I haven't tested that out.

jaquinocode commented 2 years ago

Update:

I used git to hard reset back to the point right before I ran the install-expo-modules command. (The install-expo-modules command had changed some native files before exiting with the error.)

Then I ran yarn add expo@">=44.0.0-* <45.0.0" directly in the project root. (I wrapped the version around with double quotes because zsh was giving errors without them.) The result was that I got the same error as when running npx install-expo-modules. Here's the result of the command:

ja@mac:~/code/react-native/projects/copper/@app/mobile$ yarn add expo@">=44.0.0-* <45.0.0"
➤ YN0000: ┌ Resolution step
➤ YN0001: │ Error: expo@>=44.0.0-* <45.0.0 isn't supported by any available resolver
    at Xc.getResolverByDescriptor (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:294:5330)
    at Xc.bindDescriptor (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:294:4719)
    at p (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:303:6959)
    at async Promise.all (index 6)
    at async Fe.resolveEverything (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:303:8166)
    at async /Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:306:2135
    at async xe.startTimerPromise (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:275:3730)
    at async Fe.install (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:306:2074)
    at async /Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:311:122
    at async Function.start (/Users/ja/code/react-native/projects/copper/.yarn/releases/yarn-3.0.2.cjs:275:2287)
➤ YN0000: └ Completed
➤ YN0000: Failed with errors in 0s 165ms

Based off of this, the problem seems clearly related to yarn.

Kudo commented 2 years ago

hi there! thanks for reporting this issue. #4130 addressed the issue. will let you know after we published new install-expo-modules.

jaquinocode commented 2 years ago

No problem, thank you!

Kudo commented 2 years ago

@jaquinocode the new install-expo-modules was published. you can try to run npx install-expo-modules again when you get a chance. thank you!

jaquinocode commented 2 years ago

@Kudo Thank you!

s570908 commented 2 years ago

Is it possible to run install-expo-modules in android gradle 6.xxx ? If it is, please let me know how to use it in android gradle 6.xxx.

I confirmed it works fine in android gradle 7.xxx . react-native-appearance that I am using does not work in gradle 7.xxx .

So, I want to run install-expo-modules in android gradle 6.xxx.

Kudo commented 2 years ago

@s570908 react-native-appearance is deprecated in favor of the appearance from react-native. for newer gradle support, we will add support soon when we release expo sdk 45.