npm 找不到某些 react-native 模块的依赖项 [英] npm can't find dependencies for some react-native modules
问题描述
我正在使用 create-react-native-app 创建一个反应原生应用程序
I'm creating a react native app using create-react-native-app
npm create-react-native-app
我将 react-native 版本更新为 0.44.0,这需要将 react 版本更新为 16.0.0-alpha.6这是我的 package.json
I updated react-native version to 0.44.0, which requires to update react version to 16.0.0-alpha.6 This is my 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 出现以下错误
Running npm install gives me following errors
C:dev
epo est>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.
lottie-react-native、react-native-maps、react-native-svg 和 react-static-container 似乎无法识别 react 版本 16.0.0-alpha.6.我不确定是否必须满足主要版本(15),或者这些库没有使用 alpha 版本 16,或者其他什么.有谁知道如何解决这一问题?谢谢.
It looks like react version 16.0.0-alpha.6 is not recognized by lottie-react-native, react-native-maps, react-native-svg, and react-static-container. I'm not sure if major version (15) must be met, or the alpha version 16 is not picked up by those libraries, or something else. Does anyone know how to fix this? Thanks.
推荐答案
我只是通过删除 node_modules 中的 react-native 文件夹并通过运行此命令重新安装 react-native 来解决相同的问题
I just solve the same issue by removing the react-native folder in node_modules and reinstall the react-native by run this command
- 删除 node_modules 中的 react-native 文件夹
- 通过运行
npm install react-native
重新安装 react-native
- Delete the react-native folder in node_modules
- Reinstall react-native by run
npm install react-native
我认为这比删除整个 node_modules 更简单,因为只有 react-native 包及其 package.json 丢失.
I think is more simply than deleting the entire node_modules as only the react-native packages and its package.json is missing.
这篇关于npm 找不到某些 react-native 模块的依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!