In case anyone is having a similar problem, noticed that using an outdated CLI (the legacy cli) was causing issues when some of the commands in the expo documentation were not working for me. For instance, I tried to run npx expo customize metro.config.js
and the command was not recognized.
I attempted to fix it using the first answer in this post, and when running npx expo upgrade
I got the following error:
Error: yarnpkg exited with non-zero code: 1
at ChildProcess.completionListener (/opt/homebrew/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
at Object.onceWrapper (node:events:628:26)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
...
at spawnAsync (/opt/homebrew/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
at YarnPackageManager._runAsync (/opt/homebrew/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:314:31)
at YarnPackageManager.addWithParametersAsync (/opt/homebrew/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:259:16)
at YarnPackageManager.addAsync (/opt/homebrew/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:263:5)
at upgradeAsync (/opt/homebrew/lib/node_modules/expo-cli/src/commands/info/upgradeAsync.ts:496:7)
at actionAsync (/opt/homebrew/lib/node_modules/expo-cli/src/commands/info/upgradeAsync.ts:42:3)
I had to first run yarn upgrade expo
, and then npx expo upgrade
and it seems to have fixed the expo CLI error. I am able to run the initial npx expo customize metro.config.js
command successfully as well.