当我在 react native 项目中运行这个命令时出错:expo install react-native-maps

我正在尝试在本机项目中运行此命令: expo install react-native-maps 。 但是,它总是返回此错误。我尝试删除 node_modules 并重新安装它们,但错误仍然存​​在。请帮助我,提前致谢!

    C:\Users\ASUS TUFF\Documents\Study\maps-react-native\react-native-maps>expo install react-native-maps
Installing 1 SDK 42.0.0 compatible native module using npm.
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: react-native-web@0.13.18
npm ERR! node_modules/react-native-web
npm ERR!   react-native-web@"~0.13.12" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-web@"^0.11" from react-native-maps@0.28.0
npm ERR! node_modules/react-native-maps
npm ERR!   react-native-maps@"0.28.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 ERR!
npm ERR! See C:\Users\ASUS TUFF\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ASUS TUFF\AppData\Local\npm-cache\_logs\2021-07-29T20_29_51_765Z-debug.log



npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
    at ChildProcess.completionListener (C:\Users\ASUS TUFF\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:65:13)
    at Object.onceWrapper (events.js:422:26)
    at ChildProcess.emit (events.js:315:20)
    at ChildProcess.cp.emit (C:\Users\ASUS TUFF\AppData\Roaming\npm\node_modules\expo-cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeclose (internal/child_process.js:1048:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
    ...
    at Object.spawnAsync [as default] (C:\Users\ASUS TUFF\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\spawn-async\src\spawnAsync.ts:26:19)
    at NpmPackageManager._runAsync (C:\Users\ASUS TUFF\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:166:31)
    at NpmPackageManager.addAsync (C:\Users\ASUS TUFF\AppData\Roaming\npm\node_modules\expo-cli\node_modules\@expo\package-manager\src\NodePackageManagers.ts:105:18)
    at actionAsync (C:\Users\ASUS TUFF\AppData\Roaming\npm\node_modules\expo-cli\src\commands\installAsync.ts:122:3)

C:\Users\ASUS TUFF\Documents\Study\maps-react-native\react-native-maps>
minuteslove 回答:当我在 react native 项目中运行这个命令时出错:expo install react-native-maps

这是由于 npm v7。 使用下面来安装 react-native-maps,它应该可以工作。

npm install react-native-maps --legacy-peer-deps
本文链接:https://www.f2er.com/13140.html

大家都在问