【问题标题】:Expo React Native: expected version range: ~6.0.0 - actual version installed: ^5.0.1Expo React Native:预期版本范围:~6.0.0 - 实际安装版本:^5.0.1
【发布时间】:2019-12-08 00:50:04
【问题描述】:

将 Expo SDK 33 更新到 34 后,我开始注意到一个错误,即几个 expo npm 包必须至少为 v6.0.0...

$ expo start -c
Starting project at /Users/nyxynyx/expoapp
Expo DevTools is running at http://localhost:19002

Some of your project's dependencies are not compatible with currently installed expo package version:
 - expo-ads-admob - expected version range: ~6.0.0 - actual version installed: ^5.0.1
 - expo-analytics-amplitude - expected version range: ~6.0.0 - actual version installed: ^5.0.1
 - expo-barcode-scanner - expected version range: ~6.0.0 - actual version installed: ^5.0.1
 - expo-permissions - expected version range: ~6.0.0 - actual version installed: ^5.0.1
Your project may not work correctly until you install the correct versions of the packages.
To install the correct versions of these packages, please run: expo install [package-name ...]

...

继续更新这些软件包

$ npm install --save expo-ads-admob expo-analytics-amplitude expo-barcode-scanner expo-permissions
npm WARN The package react-native-dotenv is included as both a dev and production dependency.

+ expo-permissions@5.0.1
+ expo-ads-admob@5.0.1
+ expo-analytics-amplitude@5.0.1
+ expo-barcode-scanner@5.0.1
updated 4 packages and audited 38421 packages in 5.052s
found 11 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

还尝试使用以下方法清除缓存:

rm -rf node_modules
npm cache clean
npm install
watchman watch-del-all 
rm -fr $TMPDIR/metro*
expo start -c

但是,存在关于需要 v6.0.0+ 的相同警告消息。该应用程序在 Expo iOS 客户端中运行正常(条形码扫描仪等)。我们该怎么办?

【问题讨论】:

    标签: node.js reactjs react-native npm expo


    【解决方案1】:

    如果您使用Expo,我认为这不是正确的安装方式。如果您想从Expo 安装您自己的模块,请使用此命令。

    示例

    expo install expo-ads-admob
    

    【讨论】:

    • 使用expo install而不是npm install --save成功安装了这些expo包的v6.0.0版本!
    • package.json 也已自动更新以反映 "^6.0.0" 版本要求。如果node_modules 被删除并重新安装,是否可以简单地运行npm install?或者我们必须使用expo install <packagename>单独安装expo包?
    • 删除和安装node_modules时的包。应该使用npm installyarn install,因为Package.json中反映了版本,并且需要安装其他模块。
    猜你喜欢
    • 2022-11-09
    • 2022-07-23
    • 2018-09-18
    • 2021-10-13
    • 2023-03-21
    • 2018-11-12
    • 2021-10-03
    • 2018-02-12
    • 2019-12-19
    相关资源
    最近更新 更多