React-native: Error with npm install; dependency issues

3.5k Views Asked by At

This is the issue I am facing when running npm install to install dependencies for the application I am trying to run. I'm new to Node and React:

> cd core && npm ci

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
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 [email protected]
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/[email protected]
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: [email protected]
npm ERR! node_modules/react
npm ERR!   peer react@"18.1.0" from [email protected]
npm ERR!   node_modules/react-native-windows
npm ERR!     peer react-native-windows@"*" from [email protected]
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

I've tried npm install --legacy-peer-deps resulting in a ✖ Failed to build definition files error.

Any help would be greatly appreciated!!

Edit: here are the dependencies from the 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"
1

There are 1 best solutions below

7
On

So here is what happens

tested on node v16.18.1/npm 8.19.2

  1. you have react-native-fs which pools [email protected] you can fix it by adding "react-native-windows": "0.66.5" into your dependencies (same version as your react-native).

  2. then you'll face issue with "react-native-scalable-image": "^1.1.0" which demands "react": "^16.8.3". So either get rid of react-native-scalable-image or ask maintainer to be less strict on react version

UPDATE 7 Dec 2022:

I had to

  1. patch app/package.json and core/package.json
  2. remove app/package-lock.json and core/package-lock.json
  3. run npm i in app and core

After that dependencies can be installed however build still fails. I must say the project has sick dependencies and requires a lot of attention to fix them

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",