32

Im currently trying to update my Expo SDK from 36.0.0 to atleast 37.0.0 with the command expo update however im getting the error:

  × Failed to install expo package with error: yarnpkg exited with non-zero code: 1
yarnpkg exited with non-zero code: 1
Error: yarnpkg exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.cp.emit (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (internal/child_process.js:1021:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
    ...
    at Object.spawnAsync [as default] (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:26:19)
    at YarnPackageManager._runAsync (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:288:31)
    at YarnPackageManager.addAsync (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:241:16)
    at upgradeAsync (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\src\commands\upgrade.ts:465:5)
    at C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\src\commands\upgrade.ts:701:7
    at Command.<anonymous> (C:\Users\Philipp\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:302:7)

npm version : 6.14.8 yarn version : 2.2.2 i also tried it with a lower version 1.x.x expo diagnostics :

 Expo CLI 3.27.4 environment info:
    System:
      OS: Windows 10 10.0.19041
    Binaries:
      Node: 12.18.3 - C:\Program Files\nodejs\node.EXE
      Yarn: 2.2.2 - C:\Users\Philipp\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.8 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      expo: ^36.0.0 => 36.0.2
      react: 16.9.0 => 16.9.0
      react-dom: 16.9.0 => 16.9.0
      react-native: https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz => 0.61.4
      react-native-web: ^0.11.7 => 0.11.7
      react-navigation: 3.11.1 => 3.11.1
    Expo Workflow: managed

Hopefully someone can help me, any help is appreciated. Thank you very much!

16 Answers 16

53

This is one way how I solved this issue.

I deleted the yarn.lock file & .expo folder and tried running expo upgrade and it worked.

I was upgrading from SDK 44 to SDK 45.

4
  • 3
    This helped me when upgrading from expo 44 to 46 Commented Oct 14, 2022 at 11:52
  • This helped me when upgrading from expo 44 to 45. Also, I need to run yarn upgrade to upgrade the old packages. Commented Oct 26, 2022 at 23:15
  • Getting the same error as OP after these steps. Also going from 44 to 45, using expo upgrade 45 Commented Feb 2 at 9:12
  • Use the local cli or try to upgrade the expo-cli to the latest and then try upgrading Commented Feb 3 at 10:14
41

remove this line from package.json

"react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz"

now remove node_modules

now:

yarn install

now add that line back in package.json

again

yarn install

now if it succeeds, do a

expo upgrade

I solved after 2 days

0
7

I ran yarn install (npm install should do the same thing.) in my project folder first. Then expo upgrade command worked.

4

By any chance is this a monorepo? I ran into this error because I accidentally upgrade expo in the root folder

4
  • unfortunatly it isnt.
    – HCx3
    Commented Oct 8, 2020 at 7:18
  • 1
    I experience this issue with a monorepo Commented May 7, 2021 at 10:15
  • To solve it in a monorepo, I first ran yarn install in the root Commented Oct 6, 2022 at 23:22
  • Where should we run the expo upgrade if we are working with yarn monorepos?
    – Kasra
    Commented Feb 8, 2023 at 16:00
2

For expo version 50, my issue was that my node was version 16 while node 18 is required.

2
  • i still had to delete the folders yarn.lock and .expo and then upgrade node: sudo npm install n -g and sudo n stable Commented Feb 1 at 15:43
  • @DanielCettour Interesting, for me it worked as soon as I switched node versions. Commented Feb 2 at 14:16
1

I deleted the yarn.lock file and tried running expo upgrade and it worked.

1

Personally, this error occurred because I had a package that didn't exist in my package.json. In fact, I must have made a mistake and I had this line: "package_name": "^1.0.2" in my package.json file;)

0

I ran yarn install (npm install should do the same thing.) in my project folder first. Then expo upgrade command worked.

0

just install expo-notifications using normal package installation as below instead of expo install expo-notifications use

npm i expo-notifications

0

I was running expo upgrade from root directory of my app and experienced the same error I changed to the directory of my mobile app and it ran successfully without any errors

0

Only thing I did is to delete the yarn.lock then run the upgrade command, the non-zero error goes away

0

I had the same issue when trying to run :

npx create-expo-app AwesomeProject

The cause of the problem: dependency issue between the packages coming from react-native package , so if u try to remove react-native from package.json then -> npm install no errors will appear.

The solution:

  • Go to package.json
  • Change the react-native version // mine was 17.1 I changed it to 17.0
  • Remove node modules
  • Run : npm install --legacy-peer-deps

And now it should be solved ! CHEERS !

0

I'm working on expo react native, the latest version.

This worked for me:

  • Deleting .expo
  • Deleting node_modules
  • npm install
  • expo upgrade
0

It looks like you’re using an old version of npm. Try upgrading. Also make sure you’re using a recent even-numbered version of node (e.g. version 16 or 18)

If that doesn’t fix it, you can try running the following:

npm config set legacy-peer-deps true

You can set it back to the default false again afterwards.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Apr 29, 2023 at 17:32
0

None of the provided answers worked for me, but

npm cache clean --force

did the trick

0

I already fixed it, just remove the package-lock.json and run the command again eas build -p android --profile preview

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.