rago182
rago182

Reputation: 185

expo update breaks npm install

I'm slowly upgrading my Expo project from 36.0.0 to 40.0.0. I do this by updating it one version at a time to make sure nothing breaks the app. However, I'm stuck with an issue that prevents me from doing this.

Whenever I run:

expo update

Everything works perfectly, except it fails to install the node modules. Here is the complete log:

$ expo update
Warning! Your git working tree is dirty.
It's recommended to commit all your changes before proceeding, so you can revert the changes made by this command if necessary.

√ Would you like to proceed? ... yes

√ You are currently using SDK 36.0.0. Would you like to update to the latest version, 40.0.0? ... no

√ Choose a SDK version to upgrade to: » 37.0.0

√ Would you like to upgrade the Expo app in the Android emulator? ... no

√ Installed expo@^37.0.0   
√ Removed deprecated sdkVersion field from app.json.
√ No additional changes necessary to app.json config.
× Failed to upgrade JavaScript dependencies: @react-native-community/[email protected] expo-av@~8.1.0 expo-camera@~8.2.0 expo-image-picker@~8.1.0 expo-keep-awake@~8.1.0 expo-linear-gradient@~8.1.0 expo-media-library@~8.1.0 expo-permissions@~8.1.0 expo-secure-store@~8.1.0 expo-sensors@~8.1.0 react-native-gesture-handler@~1.6.0 react-native-reanimated@~1.7.0 react-native-screens@~2.2.0 [email protected] [email protected] [email protected] @react-native-community/[email protected] [email protected] react-native@https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz [email protected] [email protected] react-native-web@^0.11.7
√ Updated known packages to compatible versions.
√ Removed package-lock.json and deleted node_modules.
× Running npm install failed. Please check npm-error.log for more information.
√ Cleared packager cache.

👏 Automated upgrade steps complete.
...but this doesn't mean everything is done yet!

✅ The following packages were updated:
@react-native-community/netinfo, expo-av, expo-camera, expo-image-picker, expo-keep-awake, expo-linear-gradient, expo-media-library, expo-permissions, expo-secure-store, expo-sensors, react-native-gesture-handler, react-native-reanimated, react-native-screens, react-native-svg, react-native-webview, react-native-safe-area-context, @react-native-community/masked-view, firebase, react-native, react, react-dom, react-native-web, babel-preset-expo, expo

🚨 The following packages were not updated. You should check the READMEs for those repositories to determine what version is compatible with your new set of packages:
Base64, lighten-darken-color, native-base, react-devtools, react-native-android-wheel-picker, react-native-auto-height-image, react-native-collapsible, react-native-drag-sort, react-native-elements, react-native-keyboard-aware-scroll-view, react-native-popup-menu, react-native-progress, react-native-progress-circle, react-native-render-html, react-native-snap-carousel, react-native-sound, 
react-native-svg-charts, react-navigation, react-navigation-stack, react-navigation-tabs, superagent, uuid, @babel/core

Please refer to the release notes for information on any further required steps to update and information about breaking changes:
https://dev.to/expo/expo-sdk-37-is-now-available-69g

I tried to manually fix this by running npm install, but I end up with this error:

gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Windows_NT 10.0.19042
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=C:\\Programming\\lcf-routine-mobile\\node_modules\\grpc\\src\\node\\extension_binary\\node-v83-win32-x64-unknown\\grpc_node.node" "--module_name=grpc_node" "--module_path=C:\\Programming\\lcf-routine-mobile\\node_modules\\grpc\\src\\node\\extension_binary\\node-v83-win32-x64-unknown" "--napi_version=7" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
gyp ERR! cwd C:\Programming\lcf-routine-mobile\node_modules\grpc
gyp ERR! node -v v14.15.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Programming\lcf-routine-mobile\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Programming\lcf-routine-mobile\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Programming\lcf-routine-mobile\node_modules\grpc\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Windows_NT 10.0.19042
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Programming\\lcf-routine-mobile\\node_modules\\grpc\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd C:\Programming\lcf-routine-mobile\node_modules\grpc
node-pre-gyp ERR! node -v v14.15.2
node-pre-gyp ERR! node-pre-gyp -v v0.14.0
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --library=static_library --module=C:\Programming\lcf-routine-mobile\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown\grpc_node.node --module_name=grpc_node --module_path=C:\Programming\lcf-routine-mobile\node_modules\grpc\src\node\extension_binary\node-v83-win32-x64-unknown --napi_version=7 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @codler/[email protected] requires a peer of react-native@>=0.63.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@>=3.14.1 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@^0.63.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native-svg@^6.2.1||^7.0.3 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Yaad\AppData\Roaming\npm-cache\_logs\2020-12-17T23_45_55_412Z-debug.log

I reinstalled NodeJS multiple times, but I don't think the issue lies there, since npm install works totally fine before running expo update. Can anyone help me out?

Upvotes: 1

Views: 2637

Answers (3)

Anas
Anas

Reputation: 1835

Try to do the below steps, at least it works for me.

at your project directory di this:

step 1: npm config set legacy-peer-deps true

step 2: rm -rf node_modules

step 3: npm install expo

step 4: expo update

Upvotes: 0

Silvio J&#228;ger
Silvio J&#228;ger

Reputation: 51

My npm installation broke on expo upgrade from SDK 40 to 41.

After some research I found out its a bug with npm version 7.xx. After downgrading to 6.x expo upgrade worked fine.

Run: npm install [email protected] -g Then try again: expo upgrade

Now you can install the latest npm version again if needed.

Maybe this helps someone✌️

Upvotes: 4

chenda2000
chenda2000

Reputation: 1

Extremely ugly solution, but I got npm install to work by copy pasting package-lock.json from before updating back into the project folder after updating (since expo upgrade deletes it)

Here are some other things I tried but gave me the same error, but maybe they'll work for you:

From the official blog post: https://dev.to/expo/expo-sdk-37-is-now-available-69g

Try updating expo-cli with

npm i -g expo-cli

and try running "expo upgrade" instead of "expo update"

Also try running

npm install --package-lock-only

and then the normal npm install

Upvotes: 0

Related Questions