简体   繁体   English

expo 更新中断 npm 安装

[英]expo update breaks npm install

I'm slowly upgrading my Expo project from 36.0.0 to 40.0.0.我正在慢慢地将我的 Expo 项目从 36.0.0 升级到 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 expo 更新

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/netinfo@5.5.1 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 react-native-svg@11.0.1 react-native-webview@8.1.1 react-native-safe-area-context@0.7.3 @react-native-community/masked-view@0.1.6 firebase@7.9.0 react-native@https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz react@16.9.0 react-dom@16.9.0 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:我尝试通过运行 npm 安装手动修复此问题,但最终出现此错误:

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 fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @codler/react-native-keyboard-aware-scroll-view@1.0.0 requires a peer of react-native@>=0.63.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-prettier@6.15.0 requires a peer of eslint@>=3.14.1 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-auto-height-image@3.2.3 requires a peer of react-native@^0.63.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-svg-charts@5.4.0 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! grpc@1.24.2 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.24.2 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.我多次重新安装了 NodeJS,但我认为问题不存在,因为 npm 安装在运行 expo 更新之前完全正常。 Can anyone help me out?谁能帮我吗?

My npm installation broke on expo upgrade from SDK 40 to 41.我的 npm 安装在 expo 从 SDK 40 expo upgrade到 41 时中断。

After some research I found out its a bug with npm version 7.xx.经过一番研究,我发现它是 npm 版本 7.xx 的错误。 After downgrading to 6.x expo upgrade worked fine.降级到 6.x expo upgrade工作正常。

Run: npm install npm@6.14.11 -g Then try again: expo upgrade运行: npm install npm@6.14.11 -g然后重试: expo upgrade

Now you can install the latest npm version again if needed.现在您可以根据需要再次安装最新的 npm 版本。

Maybe this helps someone✌️也许这对某人有帮助✌️

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)极其丑陋的解决方案,但我通过复制粘贴 package-lock.json 来安装 npm 以在更新后重新进入项目文件夹(因为 expo 升级将其删除)

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来自官方博文:https://dev.to/expo/expo-sdk-37-is-now-available-69g

Try updating expo-cli with尝试使用更新 expo-cli

npm i -g expo-cli npm i -g expo-cli

and try running "expo upgrade" instead of "expo update"并尝试运行“expo upgrade”而不是“expo update”

Also try running也尝试运行

npm install --package-lock-only npm install --package-lock-only

and then the normal npm install然后正常 npm 安装

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第 1 步: npm config set legacy-peer-deps true

step 2: rm -rf node_modules第 2 步: rm -rf node_modules

step 3: npm install expo第 3 步: npm install expo

step 4: expo update第 4 步: expo update

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM