"npm exited with non-zero code: 1" when upgrading Expo SDK from 40 to 41

Hello! I’m trying to upgrade my Expo project from SDK 40 to 41, but “expo upgrade” says:

:heavy_multiplication_x: Failed to install expo package with error: npm exited with non-zero code: 1
npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
at ChildProcess.completionListener (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:65:13)
at Object.onceWrapper (node:events:510:26)
at ChildProcess.emit (node:events:390:28)
at maybeClose (node:internal/child_process:1064:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)

at Object.spawnAsync [as default] (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/spawn-async/src/spawnAsync.ts:26:19)
at NpmPackageManager._runAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:166:31)
at NpmPackageManager.addAsync (/usr/local/lib/node_modules/expo-cli/node_modules/@expo/package-manager/src/NodePackageManagers.ts:105:18)
at upgradeAsync (/usr/local/lib/node_modules/expo-cli/src/commands/info/upgradeAsync.ts:496:7)
at actionAsync (/usr/local/lib/node_modules/expo-cli/src/commands/info/upgradeAsync.ts:42:3)

I tried deleting the node_modules folder and then “npm install” but to no avail.

Hey @orteidni, can you run expo diagnostics and share it here?

Thanks for the reply! Here’s the output:

Expo CLI 4.13.0 environment info:
System:
OS: macOS 11.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 16.13.0 - /usr/local/bin/node
npm: 8.1.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 26, 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.2, 29.0.3
System Images: android-23 | Google APIs Intel x86 Atom_64, android-28 | Google Play Intel x86 Atom
Android NDK: 20.0.5594570
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5900203
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
npmPackages:
expo: ^40.0.0 => 40.0.1
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2
react-native-web: ~0.13.12 => 0.13.18
react-navigation: ^4.0.10 => 4.4.3
npmGlobalPackages:
expo-cli: 4.13.0
Expo Workflow: managed

Included output is before updating expo-cli to 4.4.1 and running “expo update”.