Installing Packages in react-native, throwing error of "unable to resolve depedendency" - react-native

I am attempting to install the following packages in react-native:
npx expo install #react-navigation/native#5.9.8 #react-navigation/stack#5.14.9 react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view expo-constants
It has thrown the following error log:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react-native-safe-area-context#3.4.1
npm WARN node_modules/react-native-safe-area-context
npm WARN react-native-safe-area-context#"4.3.1" from the root project
npm WARN 2 more (react-native-elements, #react-navigation/stack)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-native-safe-area-context#"^3.1.9" from react-native-elements#3.4.2
npm WARN node_modules/react-native-elements
npm WARN react-native-elements#"3.4.2" from the root project
npm WARN deprecated #react-native-community/masked-view#0.1.11: Repository was moved to #react-native-masked-view/masked-view
added 25 packages, removed 1 package, changed 2 packages, and audited 1185 packages in 12s
54 packages are looking for funding
run `npm fund` for details
6 high severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
> npm install --save #react-native-community/masked-view
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-native-elements#3.4.2
npm ERR! Found: react-native-safe-area-context#4.3.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context#">= 0.6.0" from #react-navigation/stack#5.14.9
npm ERR! node_modules/#react-navigation/stack
npm ERR! #react-navigation/stack#"5.14.9" from the root project
npm ERR! react-native-safe-area-context#"4.3.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-safe-area-context#"^3.1.9" from react-native-elements#3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements#"3.4.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-safe-area-context#3.4.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context#"^3.1.9" from react-native-elements#3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements#"3.4.2" 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!
npm ERR! For a full report see:
npm ERR! C:\Users\isena\AppData\Local\npm-cache\_logs\2022-12-09T22_33_54_680Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\isena\AppData\Local\npm-cache\_logs\2022-12-09T22_33_54_680Z-debug-0.log
here is my package-json:
{
"name": "nucampsite",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "^46.0.13",
"expo-status-bar": "^1.4.0",
"react": "^18.0.0",
"react-native": "^0.69.6",
"react-native-elements": "3.4.2",
"#react-navigation/native": "5.9.8",
"#react-navigation/stack": "5.14.9",
"react-native-reanimated": "~2.9.1",
"react-native-gesture-handler": "~2.5.0",
"react-native-screens": "~3.15.0",
"react-native-safe-area-context": "4.3.1",
"expo-constants": "~13.2.4"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
I have tried updating react with npm install react#latest
which threw me the following error log:
npm install react#latest
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react#18.0.0
npm WARN node_modules/react
npm WARN peer react#">=16.0" from #react-native-community/masked-view#0.1.11
npm WARN node_modules/#react-native-community/masked-view
npm WARN peer #react-native-community/masked-view#">= 0.1.0" from #react-navigation/stack#5.14.9
npm WARN node_modules/#react-navigation/stack
npm WARN 13 more (#react-navigation/core, #react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.0.0" from react-native#0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native#"*" from #react-native-community/cli#8.0.6
npm WARN node_modules/#react-native-community/cli
npm WARN 11 more (#react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react#18.0.0
npm WARN node_modules/react
npm WARN peer react#">=16.0" from #react-native-community/masked-view#0.1.11
npm WARN node_modules/#react-native-community/masked-view
npm WARN peer #react-native-community/masked-view#">= 0.1.0" from #react-navigation/stack#5.14.9
npm WARN node_modules/#react-navigation/stack
npm WARN 13 more (#react-navigation/core, #react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.0.0" from react-native#0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native#"*" from #react-native-community/cli#8.0.6
npm WARN node_modules/#react-native-community/cli
npm WARN 11 more (#react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react#18.0.0
npm WARN node_modules/react
npm WARN peer react#">=16.0" from #react-native-community/masked-view#0.1.11
npm WARN node_modules/#react-native-community/masked-view
npm WARN peer #react-native-community/masked-view#">= 0.1.0" from #react-navigation/stack#5.14.9
npm WARN node_modules/#react-navigation/stack
npm WARN 13 more (#react-navigation/core, #react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.0.0" from react-native#0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native#"*" from #react-native-community/cli#8.0.6
npm WARN node_modules/#react-native-community/cli
npm WARN 11 more (#react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react#18.0.0
npm WARN node_modules/react
npm WARN peer react#">=16.0" from #react-native-community/masked-view#0.1.11
npm WARN node_modules/#react-native-community/masked-view
npm WARN peer #react-native-community/masked-view#">= 0.1.0" from #react-navigation/stack#5.14.9
npm WARN node_modules/#react-navigation/stack
npm WARN 13 more (#react-navigation/core, #react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.0.0" from react-native#0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native#"*" from #react-native-community/cli#8.0.6
npm WARN node_modules/#react-native-community/cli
npm WARN 11 more (#react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react#18.0.0
npm WARN node_modules/react
npm WARN peer react#">=16.0" from #react-native-community/masked-view#0.1.11
npm WARN node_modules/#react-native-community/masked-view
npm WARN peer #react-native-community/masked-view#">= 0.1.0" from #react-navigation/stack#5.14.9
npm WARN node_modules/#react-navigation/stack
npm WARN 13 more (#react-navigation/core, #react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.0.0" from react-native#0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native#"*" from #react-native-community/cli#8.0.6
npm WARN node_modules/#react-native-community/cli
npm WARN 11 more (#react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react#18.0.0
npm WARN node_modules/react
npm WARN peer react#">=16.0" from #react-native-community/masked-view#0.1.11
npm WARN node_modules/#react-native-community/masked-view
npm WARN peer #react-native-community/masked-view#">= 0.1.0" from #react-navigation/stack#5.14.9
npm WARN node_modules/#react-navigation/stack
npm WARN 13 more (#react-navigation/core, #react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.0.0" from react-native#0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native#"*" from #react-native-community/cli#8.0.6
npm WARN node_modules/#react-native-community/cli
npm WARN 11 more (#react-native-community/masked-view, ...)
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: nucampsite#1.0.0
npm WARN Found: react#18.0.0
npm WARN node_modules/react
npm WARN peer react#">=16.0" from #react-native-community/masked-view#0.1.11
npm WARN node_modules/#react-native-community/masked-view
npm WARN peer #react-native-community/masked-view#">= 0.1.0" from #react-navigation/stack#5.14.9
npm WARN node_modules/#react-navigation/stack
npm WARN 13 more (#react-navigation/core, #react-navigation/native, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.0.0" from react-native#0.69.6
npm WARN node_modules/react-native
npm WARN peer react-native#"*" from #react-native-community/cli#8.0.6
npm WARN node_modules/#react-native-community/cli
npm WARN 11 more (#react-native-community/masked-view, ...)
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: react-native-elements#3.4.2
npm ERR! Found: react-native-safe-area-context#4.3.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context#">= 0.6.0" from #react-navigation/stack#5.14.9
npm ERR! node_modules/#react-navigation/stack
npm ERR! #react-navigation/stack#"5.14.9" from the root project
npm ERR! react-native-safe-area-context#"4.3.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native-safe-area-context#"^3.1.9" from react-native-elements#3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements#"3.4.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react-native-safe-area-context#3.4.1
npm ERR! node_modules/react-native-safe-area-context
npm ERR! peer react-native-safe-area-context#"^3.1.9" from react-native-elements#3.4.2
npm ERR! node_modules/react-native-elements
npm ERR! react-native-elements#"3.4.2" 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.
Thanks for the help!

UPDATE:
The fix I discovered was very simple: instead of forcing the installs through with --force or --legacy-peer-deps, I actually deleted the line
"react-native-safe-area-context": "4.3.1"
from my package.json.
I am in a coding bootcamp and that is the solution we figured out with our instructor.

Related

SPFx resolving dependency issues

While following this training unit by Microsoft
Exercise - Use the SPFx PnP reusable property pane controls I encounter errors, any advice on how to resolve these issues?
Environment Info
Platform: Windows
nodeJS v16.18.1
npm 8.19.2
gulp CLI version: 2.3.0
gulp Local version: 4.0.2
yeoman 4.3.1
#microsoft/generator-sharepoint#1.16.1
Problem
When I execute the following command
npm install #pnp/spfx-property-controls --save --save-exact
I get this output:
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-ace#5.8.0
npm WARN Found: react#17.0.1
npm WARN node_modules/#pnp/spfx-property-controls/node_modules/react
npm WARN react#"17.0.1" from #pnp/spfx-property-controls#3.11.0
npm WARN node_modules/#pnp/spfx-property-controls
npm WARN #pnp/spfx-property-controls#"*" from the root project
npm WARN 6 more (#microsoft/sp-core-library, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0" from react-ace#5.8.0
npm WARN node_modules/#pnp/spfx-property-controls/node_modules/react-ace
npm WARN react-ace#"5.8.0" from #pnp/spfx-property-controls#3.11.0
npm WARN node_modules/#pnp/spfx-property-controls
npm WARN
npm WARN Conflicting peer dependency: react#16.14.0
npm WARN node_modules/react
npm WARN peer react#"^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0" from react-ace#5.8.0
npm WARN node_modules/#pnp/spfx-property-controls/node_modules/react-ace
npm WARN react-ace#"5.8.0" from #pnp/spfx-property-controls#3.11.0
npm WARN node_modules/#pnp/spfx-property-controls
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-ace#5.8.0
npm WARN Found: react-dom#17.0.1
npm WARN node_modules/#pnp/spfx-property-controls/node_modules/react-dom
npm WARN react-dom#"17.0.1" from #pnp/spfx-property-controls#3.11.0
npm WARN node_modules/#pnp/spfx-property-controls
npm WARN #pnp/spfx-property-controls#"*" from the root project
npm WARN 5 more (#microsoft/sp-core-library, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react-dom#"^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0" from react-ace#5.8.0
npm WARN node_modules/#pnp/spfx-property-controls/node_modules/react-ace
npm WARN react-ace#"5.8.0" from #pnp/spfx-property-controls#3.11.0
npm WARN node_modules/#pnp/spfx-property-controls
npm WARN
npm WARN Conflicting peer dependency: react-dom#16.14.0
npm WARN node_modules/react-dom
npm WARN peer react-dom#"^0.13.0 || ^0.14.0 || ^15.0.1 || ^16.0.0" from react-ace#5.8.0
npm WARN node_modules/#pnp/spfx-property-controls/node_modules/react-ace
npm WARN react-ace#"5.8.0" from #pnp/spfx-property-controls#3.11.0
npm WARN node_modules/#pnp/spfx-property-controls
added 50 packages, and audited 2693 packages in 53s
171 packages are looking for funding
run `npm fund` for details
86 vulnerabilities (30 moderate, 47 high, 9 critical)
After performing the edits to the default project template as described in the tutorial gulp serve is successful - no errors, but the workbench displays an error (several other errors in dev tools as well)
The componentId
in message:
Manifest not found for component id "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d" and version "17.0.2". refers to react components.
{
"componentId": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"componentName": "react",
"componentVersion": "17.0.1",
"isDirectDependency": false
},
{
"componentId": "0d910c1c-13b9-4e1c-9aa4-b008c5e42d7d",
"componentName": "react",
"componentVersion": "17.0.2",
"isDirectDependency": true
}
Any help is appreciated.

How to use i18n-iso-countries in react-native?

I need to get the country names in different languages ( using localization )
I found this library i18n-iso-countries : https://www.npmjs.com/package/i18n-iso-countries
doing what I need , but when I tried to install it using npm install i18n-iso-countries I got these errors :
`npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: qoyod_mobile#1.5.4 npm ERR! Found: react-native#0.70.3 npm ERR! node_modules/react-native npm ERR! peer react-native#"*" from #intercom/intercom-react-native#3.0.5 npm ERR! node_modules/#intercom/intercom-react-native npm ERR! #intercom/intercom-react-native#"^3.0.5" from the root project npm ERR! peer react-native#"^0.0.0-0 || 0.60 - 0.70 || 1000.0.0" from #react-native-async-storage/async-storage#1.17.10 npm ERR! node_modules/#react-native-async-storage/async-storage npm ERR! #react-native-async-storage/async-storage#"^1.17.10" from the root project npm ERR! 36 more (#react-native-community/masked-view, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! dev react-native#"0.70.5" 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#0.70.5 npm ERR! node_modules/react-native npm ERR! dev react-native#"0.70.5" 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\username\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\username\AppData\Local\npm-cache\_logs\2022-12-04T13_04_11_830Z-debug-0.log`
How can I use this library in react-native , or is there and alternative library in react native that can give me the countries in different languages ?
From your error looks like you have a peer dependency conflict. This is an article on how to resolve it https://www.folkstalk.com/2022/09/fix-the-upstream-dependency-conflict-installing-npm-packages-with-code-examples.html

npm ERR! Cannot read properties of null (reading 'matches')

After I installed hexo, I used npm install to complete the packages in package.json, but he reported an error, the content of the error is as follows
❯ node --version
v18.12.1
❯ npm --version
9.1.3
❯ npm install
············
npm WARN dev eslint-config-standard#"12.0.0" from compression#1.7.4
npm WARN node_modules/.pnpm/compression#1.7.4/node_modules/compression
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: babel-eslint#11.0.0-beta.2
npm WARN Found: eslint#5.16.0
npm WARN node_modules/.pnpm/cross-spawn#7.0.3/node_modules/eslint
npm WARN dev eslint#"^5.16.0" from cross-spawn#7.0.3
npm WARN node_modules/.pnpm/cross-spawn#7.0.3/node_modules/cross-spawn
npm WARN cross-spawn#7.0.3
npm WARN node_modules/.pnpm/hexo-util#2.7.0/node_modules/cross-spawn
npm WARN cross-spawn#7.0.3
npm WARN node_modules/.pnpm/node_modules/cross-spawn
npm WARN 4 more (eslint-config-moxy, eslint-plugin-babel, ...)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer eslint#">= 6.0.0" from babel-eslint#11.0.0-beta.2
npm WARN node_modules/.pnpm/cross-spawn#7.0.3/node_modules/babel-eslint
npm WARN babel-eslint#"^11.0.0-beta.0" from eslint-config-moxy#7.1.0
npm WARN node_modules/.pnpm/cross-spawn#7.0.3/node_modules/eslint-config-moxy
npm ERR! Cannot read properties of null (reading 'matches')
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhangyun/.npm/_logs/2022-12-02T01_51_51_393Z-debug-0.log
I tried running npm cache clear --force, or changing the npm mirror, but that didn't work

React native npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR?

npm install not working I am facing this error logs
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving:xxx#0.0.1
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"17.0.2" from the root project
npm ERR! peer react#"*" from react-native-country-picker-modal#2.0.0
npm ERR! node_modules/react-native-country-picker-modal
npm ERR! react-native-country-picker-modal#"^2.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-dom#18.2.0
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#"*" from react-native-country-picker-modal#2.0.0
Resolved this error by using
npm install --force
npm install --legacy-peer-deps
or
we can use yarn install in some cases yarn works

NPM peer dependency conflict

I have my-package that has #angular/common#"^12.2.6" as peer dependency and root project that also has #angular/common#"^12.2.6" as a dependency, but npm install is giving me this error:
npm ERR!
npm ERR! Conflicting peer dependency: #angular/common#12.2.10
npm ERR! node_modules/#angular/common
npm ERR! peer #angular/common#"^12.2.6" from my-package#2.1.3
npm ERR! node_modules/pi-diagram
npm ERR! my-package#"2.1.3" from the root project
npm ERR!
Does 12.2.10 not match ^12.2.6 specification?