React-native:错误与npm install;依赖的问题



这是我在运行npm install为我试图运行的应用程序安装依赖项时面临的问题。我是Node和React的新手:

> cd core && npm ci
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: react-native-fs@2.18.0
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   peer react@"17.0.2" from the root project
npm ERR!   peer react@"^17.0.2" from @aries-framework/react-hooks@0.3.0
npm ERR!   node_modules/@aries-framework/react-hooks
npm ERR!     peer @aries-framework/react-hooks@"^0.3.0" from the root project
npm ERR!   31 more (@expo/react-native-action-sheet, ...)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-windows@"*" from react-native-fs@2.18.0
npm ERR! node_modules/react-native-fs
npm ERR!   peer react-native-fs@"^2.16.6" from the root project
npm ERR!   peer react-native-fs@"^2.18.0" from @aries-framework/react-native@0.2.2
npm ERR!   node_modules/@aries-framework/react-native
npm ERR!     peer @aries-framework/react-native@"^0.2.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: react@18.1.0
npm ERR! node_modules/react
npm ERR!   peer react@"18.1.0" from react-native-windows@0.70.5
npm ERR!   node_modules/react-native-windows
npm ERR!     peer react-native-windows@"*" from react-native-fs@2.18.0
npm ERR!     node_modules/react-native-fs
npm ERR!       peer react-native-fs@"^2.16.6" from the root project
npm ERR!       1 more (@aries-framework/react-native)
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/samueloneill/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/samueloneill/.npm/_logs/2022-11-08T11_54_30_572Z-debug-0.log
ERROR: "ci:core" exited with 1.
ERROR: "ci:all" exited with 1.
npm ERR! code 1
npm ERR! path /Users/samueloneill/aries-mobile-agent-react-native
npm ERR! command failed
npm ERR! command sh -c run-s ci:all build:all

我尝试了npm install—legacy-peer-deps,结果出现了一个Failed to build definition files错误。

任何帮助将非常感激!!

编辑:这里是package.json中的依赖项


"@aries-framework/core": "^0.2.2",
"@aries-framework/react-hooks": "^0.3.0",
"@aries-framework/react-native": "^0.2.0",
"@formatjs/intl-datetimeformat": "^4.2.3",
"@formatjs/intl-displaynames": "^5.2.3",
"@formatjs/intl-getcanonicallocales": "^1.7.3",
"@formatjs/intl-listformat": "^6.3.3",
"@formatjs/intl-locale": "^2.4.37",
"@formatjs/intl-numberformat": "^7.2.3",
"@formatjs/intl-pluralrules": "^4.1.3",
"@formatjs/intl-relativetimeformat": "^9.2.3",
"@react-native-async-storage/async-storage": "^1.12.1",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^9.3.0",
"@react-navigation/bottom-tabs": "^6.0.9",
"@react-navigation/core": "^6.1.0",
"@react-navigation/devtools": "^6.0.8",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"axios": "^0.21.0",
"i18next": "^21.4.0",
"indy-sdk-react-native": "^0.2.2",
"lodash.flatten": "^4.4.0",
"lodash.startcase": "^4.4.0",
"query-string": "^7.0.1",
"react": "17.0.2",
"react-i18next": "^11.13.0",
"react-native": "0.66.5",
"react-native-animated-pagination-dots": "^0.1.72",
"react-native-argon2": "^2.0.1",
"react-native-bouncy-checkbox": "^3.0.5",
"react-native-camera": "^3.31.1",
"react-native-collapsible": "^1.6.0",
"react-native-config": "^1.4.2",
"react-native-confirmation-code-field": "^7.3.0",
"react-native-device-info": "^8.4.9",
"react-native-encrypted-storage": "^4.0.2",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "^1.10.3",
"react-native-get-random-values": "^1.7.0",
"react-native-gifted-chat": "^0.16.3",
"react-native-keychain": "^8.1.1",
"react-native-localize": "^2.1.5",
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.2.0",
"react-native-scalable-image": "^1.1.0",
"react-native-screens": "^3.3.0",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^12.1.1",
"react-native-toast-message": "^2.0.1",
"react-native-uuid": "^2.0.1",
"react-native-vector-icons": "^8.1.0",
"uuid": "^8.1.0"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@babel/runtime": "^7.12.5",
"@commitlint/cli": "^11.0.0",
"@react-native-community/eslint-config": "^2.0.0",
"@testing-library/jest-native": "^4.0.4",
"@testing-library/react-native": "^9.0.0",
"@types/indy-sdk-react-native": "npm:@types/indy-sdk@^1.16.18",
"@types/jest": "^27.4.0",
"@types/lodash.flatten": "^4.4.6",
"@types/lodash.startcase": "^4.4.6",
"@types/react": "^16.14.4",
"@types/react-native": "^0.63.50",
"@types/react-native-vector-icons": "^6.4.6",
"@types/react-test-renderer": "^16.9.5",
"@typescript-eslint/eslint-plugin": "^4.20.0",
"@typescript-eslint/parser": "^4.33.0",
"babel-jest": "^27.5.1",
"babel-plugin-module-resolver": "^4.1.0",
"commitlint": "^11.0.0",
"eslint": "^7.14.0",
"eslint-import-resolver-typescript": "^2.5.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-prettier": "^3.3.1",
"husky": "^7.0.0",
"jest": "^27.5.1",
"lint-staged": "^11.2.6",
"metro-react-native-babel-preset": "^0.66.2",
"mockdate": "^3.0.5",
"node-notifier": "^10.0.1",
"patch-package": "^6.4.4",
"prettier": "^2.1.2",
"react-native-builder-bob": "^0.18.2",
"react-native-flipper": "^0.154.0",
"react-native-svg-transformer": "^0.14.3",
"react-test-renderer": "17.0.2",
"ts-jest": "^27.1.3",
"typescript": "^4.2.2"

结果如下

在节点v16.18.1/npm 8.19.2上测试

  1. 你有react-native-fs池react-native-windows@0.70.5,你可以通过将"react-native-windows": "0.66.5"添加到你的依赖项(与你的react-native相同的版本)来修复它。

  2. 那么你将面临"react-native-scalable-image": "^1.1.0"的问题,这需要"react": "^16.8.3"。所以要么去掉react-native-scalable-image,要么要求维护者对react版本不那么严格

UPDATE 7 Dec 2022:

I had to

  1. patchapp/package.jsonandcore/package.json
  2. 删除app/package-lock.jsoncore/package-lock.json
  3. appcore中运行npm i

在此之后可以安装依赖项,但是构建仍然失败。我必须说这个项目有病态的依赖关系,需要大量的精力来修复它们

Index: app/package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/package.json b/app/package.json
--- a/app/package.json  (revision faffa2806a8980b0655a35a94fc7cabd32699922)
+++ b/app/package.json  (revision d8f3ceca67e237fea1090451412e7297c5bb14bb)
@@ -40,6 +40,7 @@
"react": "17.0.2",
"react-i18next": "11.13.0",
"react-native": "0.66.5",
+    "react-native-windows": "0.66.5",
"react-native-animated-pagination-dots": "0.1.72",
"react-native-argon2": "2.0.1",
"react-native-bouncy-checkbox": "^3.0.5",
@@ -58,7 +59,6 @@
"react-native-qrcode-svg": "6.1.1",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "3.3.2",
-    "react-native-scalable-image": "^1.1.0",
"react-native-screens": "3.7.2",
"react-native-splash-screen": "3.3.0",
"react-native-svg": "12.1.1",
Index: core/package.json
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/core/package.json b/core/package.json
--- a/core/package.json (revision faffa2806a8980b0655a35a94fc7cabd32699922)
+++ b/core/package.json (revision d8f3ceca67e237fea1090451412e7297c5bb14bb)
@@ -48,6 +48,7 @@
"react": "17.0.2",
"react-i18next": "^11.13.0",
"react-native": "0.66.5",
+    "react-native-windows": "0.66.5",
"react-native-animated-pagination-dots": "^0.1.72",
"react-native-argon2": "^2.0.1",
"react-native-bouncy-checkbox": "^3.0.5",
@@ -66,7 +67,6 @@
"react-native-qrcode-svg": "^6.0.6",
"react-native-reanimated": "^2.2.4",
"react-native-safe-area-context": "^3.2.0",
-    "react-native-scalable-image": "^1.1.0",
"react-native-screens": "^3.3.0",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^12.1.1",

相关内容

  • 没有找到相关文章

最新更新