gpt4 book ai didi

npm 找不到某些 react-native 模块的依赖项

转载 作者:行者123 更新时间:2023-12-05 07:43:11 24 4
gpt4 key购买 nike

我正在使用 create-react-native-app 创建一个 React Native 应用

npm create-react-native-app 

我更新了react-native版本到0.44.0,这需要更新react版本到16.0.0-alpha.6这是我的 package.json

{
"name": "test",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "0.0.29",
"jest-expo": "^0.4.0",
"react-test-renderer": "~15.5.4"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/ex-navigation": "^2.11.1",
"babel-preset-react-native-stage-0": "^1.0.1",
"expo": "^16.0.0",
"react": "~16.0.0-alpha.6",
"react-native": "0.44.0"
}
}

运行 npm install 会出现以下错误

C:\dev\repo\test>npm install
npm WARN lottie-react-native@1.1.1 requires a peer of react@>=15.3.1 but none was installed.
npm WARN react-native-maps@0.12.2 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-native-svg@4.4.1 requires a peer of react@>=15.4.0 but none was installed.
npm WARN react-static-container@1.0.1 requires a peer of react@^0.13.0 || ^0.14.0 || ^15.0.0 but none was installed.

看起来 react 版本 16.0.0-alpha.6 无法被 lottie-react-native、react-native-maps、react-native-svg 和 react-static-container 识别。我不确定是否必须满足主要版本 (15),或者这些库未使用 alpha 版本 16,或者其他。有谁知道如何解决这一问题?谢谢。

最佳答案

我有一个类似的问题,实际上现在我遇到了这个问题,每当我尝试使用 create-react-native-app 创建一个新的应用程序时。我现在找到的唯一解决方案 (hack) 是:

  1. 删除 node_modules(对我来说,仅仅执行 npm install 是不够的)
  2. 执行npm install

关于npm 找不到某些 react-native 模块的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43919115/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com