完全重新安装后尝试安装react-native-maps-directions时,Expo应用程序抛出错误
我进入了调试远程 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: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"17.0.1" from the root project
npm ERR! peer react@"*" from [email protected]
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 [email protected]
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 [email protected]
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
有什么想法吗?我应该做什么?我将不胜感激任何帮助。谢谢。
I entered Debug Remote JS mode and this caused some errors with react-native-reanimated package, I found here https://github.com/gorhom/react-native-bottom-sheet/issues/771#issuecomment-1048324630 that if I upgrade to the version 2.4.1 it would work, and so I did and it worked but I got a warning from expo that this version is incompatible and my app may not work as expected. So I Removed node_modules and renamed it in package.json from 2.4.1 back to 2.3.1.
At first I had lots of trouble installig it again as "expo install" was throwing errors from app.config.ts because I had used dotenv there and I was unable to install it for some reason. At first npm install failed as well but after second time it kind of installed all the packages, but I am still getting errors from simulator. When I open app on a device it seems to be ok, but the simulator instantly throws
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';
now I am trying to run
npm i react-native-maps-directions
And I am unable to install the package for the following reason:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"17.0.1" from the root project
npm ERR! peer react@"*" from [email protected]
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 [email protected]
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 [email protected]
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
Any ideas whay is it happening and what should I do? I'd appreciate any help. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

运行
npm install react-native-maps-directions --force
或npm install react-native-maps-directions --legacy-peer-deps
这将忽略对等方依赖错误,并且将仅继续主要依赖项,在本例中为react-native-maps-directions。
每当我收到此错误时,这都对我有用
run either
npm install react-native-maps-directions --force
ornpm install react-native-maps-directions --legacy-peer-deps
this will ignore the peer dependency error, and will just proceed with the main dependency, in this case react-native-maps-directions.
this has worked for me whenever i've gotten this error