reactjs 依赖项与安装的expo包版本不兼容,找不到模块“nocache”

new9mtju  于 2023-01-17  发布在  React
关注(0)|答案(2)|浏览(244)

我真的希望你们中的一些人能帮助我。所以我做了一些升级在我的一个旧的应用程序(它已经在商店),然后当我试图上传apk它说我需要一个API 30(我的是29)。所以我试图升级SDK和博览会。从那一刻起一切都不工作。这里发送的错误,我有:
博览会开始..

Some dependencies are incompatible with the installed expo package version:

 - expo-ads-admob - expected version: ~10.0.4 - actual version installed: 8.3.0
 - expo-font - expected version: ~9.1.0 - actual version installed: 8.3.0
 - expo-updates - expected version: ~0.5.4 - actual version installed: 0.3.5
 - react-native-gesture-handler - expected version: ~1.10.2 - actual version installed: 1.7.0
 - react-native-reanimated - expected version: ~2.1.0 - actual version installed: 1.13.4
 - react-native-safe-area-context - expected version: 3.2.0 - actual version installed: 3.1.4
 - react-native-screens - expected version: ~3.0.0 - actual version installed: 2.10.1
 - react-native-unimodules - expected version: ~0.13.3 - actual version installed: 0.12.0

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 doctor --fix-dependencies,
or install individual packages by running expo install [package-name ...]
Cannot find module 'nocache'
Require stack:
- C:\Users\gameZone\node_modules\@react-native-community\cli-server-api\build\index.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\build\metro\importMetroFromProject.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\build\HermesBundler.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\build\MetroDevServer.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\start\startDevServerAsync.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\internal.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
Error: Cannot find module 'nocache'
Require stack:
- C:\Users\gameZone\node_modules\@react-native-community\cli-server-api\build\index.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\build\metro\importMetroFromProject.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\build\HermesBundler.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\build\MetroDevServer.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\start\startDevServerAsync.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\internal.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\build\index.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\build\exp.js
- C:\Users\AppData\Roaming\npm\node_modules\expo-cli\bin\expo.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at _nocache (C:\Users\gameZone\node_modules\@react-native-community\cli-server-api\build\index.js:105:39)
    at createDevServerMiddleware (C:\Users\gameZone\node_modules\@react-native-community\cli-server-api\build\index.js:164:47)
    at createDevServerMiddleware (C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\src\middleware\devServerMiddleware.ts:54:7)
    at runMetroDevServerAsync (C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\dev-server\src\MetroDevServer.ts:96:32)
    at startDevServerAsync (C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\src\start\startDevServerAsync.ts:77:49)
    at startAsync (C:\Users\AppData\Roaming\npm\node_modules\expo-cli\node_modules\xdl\src\start\startAsync.ts:69:41)

当我尝试“expo doctor -fix-dependencies”时,会发生以下情况:

Unable to reach Expo servers. Falling back to using the cached dependency map (bundledNativeModules.json) from the package "expo" installed in your project.
Installing 8 SDK 41.0.0 compatible native modules using npm.
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: react-native-screens@3.0.0
npm ERR! node_modules/react-native-screens
npm ERR!   react-native-screens@"~3.0.0" from the root project
npm ERR!   peer react-native-screens@">= 2.0.0-alpha.0 || >= 2.0.0-beta.0 || >= 2.0.0" from @react-navigation/stack@5.14.9
npm ERR!   node_modules/@react-navigation/stack
npm ERR!     @react-navigation/stack@"^5.9.2" from the root project
npm ERR!   1 more (@react-navigation/drawer)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-screens@"^1.0.0 || ^1.0.0-alpha" from react-navigation-drawer@1.4.0
npm ERR! node_modules/react-navigation-drawer
npm ERR!   react-navigation-drawer@"^1.4.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

我也尝试了“npm安装”和“yarn安装”,并手动升级了列表中的一些依赖项,例如“react-native-screen”或“react-font”。

nc1teljy

nc1teljy1#

您可以尝试删除package.lock.json,然后重新运行该命令

expo doctor --fix-dependencies
ioekq8ef

ioekq8ef2#

有两种方法可以解决此问题
1.更新expo并运行expo update将依赖项设置为与我的SDK兼容的东西似乎为我解决了这个问题npm install -g expo-cli expo update

相关问题