完全重新安装后尝试安装 react-native-maps-directions 时,Expo 应用程序抛出错误

Expo app throwing errors when trying to install react-native-maps-directions after full reinstall

我进入了 Debug Remote JS 模式,这导致 react-native-reanimated 包出现一些错误,我在这里 https://github.com/gorhom/react-native-bottom-sheet/issues/771#issuecomment-1048324630 发现如果我升级到 2.4.1 版本它会工作,所以我做到了它有效,但我从世博会收到警告,说这个版本不兼容,我的应用程序可能无法按预期工作。所以我删除了 node_modules 并在 package.json 中将其从 2.4.1 重命名为 2.3.1.

起初我在重新安装它时遇到了很多麻烦,因为“expo install”从 app.config.ts 中抛出错误,因为我在那里使用了 dotenv,但由于某种原因我无法安装它。起初 npm install 也失败了,但第二次后它安装了所有的包,但我仍然从模拟器中得到错误。当我在设备上打开应用程序时似乎没问题,但模拟器立即抛出

Unable to resolve module ./interpolateColor from /Users/seven/Dev/Reminder/node_modules/react-native-reanimated/src/reanimated2/index.ts: 
None of these files exist:
  * node_modules/react-native-reanimated/src/reanimated2/interpolateColor(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
  * node_modules/react-native-reanimated/src/reanimated2/interpolateColor/index(.native|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json)
> 1 | export * from './core';
  2 | export * from './hook';
  3 | export * from './animation';
  4 | export * from './interpolation';

现在我正在尝试 运行

npm i react-native-maps-directions

我无法安装软件包,原因如下:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: check-app@1.0.0
npm ERR! Found: react@17.0.1
npm ERR! node_modules/react
npm ERR!   react@"17.0.1" from the root project
npm ERR!   peer react@"*" from react-native-maps-directions@1.8.0
npm ERR!   node_modules/react-native-maps-directions
npm ERR!     react-native-maps-directions@"*" from the root project
npm ERR!   3 more (react-native, react-native-maps, react-native-web)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"17.0.2" from react-dom@17.0.2
npm ERR! node_modules/react-dom
npm ERR!   react-dom@"^17.0.1" from the root project
npm ERR!   peer react-dom@">=17.0.1" from react-native-web@0.17.7
npm ERR!   node_modules/react-native-web
npm ERR!     react-native-web@"^0.17.1" from the root project
npm ERR!     1 more (react-native-maps)
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 ERR! 
npm ERR! See /Users/seven/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/seven/.npm/_logs/2022-03-11T09_08_16_642Z-debug.log

知道这是怎么回事吗?我该怎么办?我将不胜感激任何帮助。谢谢

运行 npm install react-native-maps-directions --forcenpm install react-native-maps-directions --legacy-peer-deps

这将忽略对等依赖错误,并且将继续处理主依赖,在本例中 react-native-maps-directions。

每当我遇到这个错误时,这对我有用