React Native - Error while initialising new project - react-native

I am getting following error when I try to run command
npx react-native init AwesomeProject
npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR!
npm ERR! While resolving: undefined#undefined npm ERR! Found:
react-native#0.68.2 npm ERR! node_modules/react-native npm ERR! peer
react-native#"*" from #react-native-community/cli#7.0.3 npm ERR!
node_modules/#react-native-community/cli npm ERR!
#react-native-community/cli#"^7.0.3" from react-native#0.68.2 npm ERR!
react-native#"0.69.0" from the root project npm ERR! npm ERR! Could
not resolve dependency: npm ERR! react-native#"0.69.0" from the root
project npm ERR! npm ERR! Conflicting peer dependency: react#18.0.0
npm ERR! node_modules/react npm ERR! peer react#"18.0.0" from
react-native#0.69.0 npm ERR! node_modules/react-native npm ERR!
react-native#"0.69.0" 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\NIMASHA NAIK\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\NIMASHA
NAIK\AppData\Local\npm-cache_logs\2022-06-23T13_40_58_714Z-debug-0.log
Please can anyone help?
Thank You.

Removing the ~/.npm cache folder worked for me
rm -r ~/.npm

I had the same problem so I did it
npm config set legacy-peer-deps true
npx react-native
try it worked.

npm add react-native#0.69.0
Run this command to upgrade react-native. Hope it works.

Are you able to post the full log found in your AppData?
You could also try completely removing node.js from your system and try reinstalling it again.
https://nodejs.org/en/
Install the LTS version and try this again. Also make sure npm and npx are both working in your working directory PATH.

This is an issue in node which is caused by white space in user name between first-name and last-name in windows.
run the following command after replacing firstname with your windows user firstname in command prompt with administrator access
npm config set cache "C:\Users\Firstname~1\AppData\Roaming\npm-cache" --global

Related

ERESOLVE unable to resolve dependency tree while installing Font Awesome

I am workin on a react native project and I tried installing Font Awesome "npm i --save #fortawesome/react-native-fontawesome #fortawesome/fontawesome-svg-core react-native-svg"
using but I got
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: homesick#1.0.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"^18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"18.0.0" from react-native#0.69.4
npm ERR! node_modules/react-native
npm ERR! react-native#"0.69.4" from the root project
npm ERR! peer react-native#">= 0.67" from #fortawesome/react-native-fontawesome#0.3.0
npm ERR! node_modules/#fortawesome/react-native-fontawesome
npm ERR! #fortawesome/react-native-fontawesome#"*" 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 /Users/itaylador/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/itaylador/.npm/_logs/2022-08-15T22_50_28_934Z-debug-0.log
How can I solve this error?
I had the same issue recently. Tried a lot configurations but the only thing that worked for me was downgrade from react#18.2.0 to react#18.0.0 in the package.json
Some other guys here on stackoverflow gave the hint (if you have peer dependency conflicts) to open (on MacOS) /Users/YourUser/.npm folder and delete the folders _cacache, _logs, _npx
You can also try to delete node_modules folder and package-lock.json file at the end and re-install via "npm install"

Git - Cloning Vue.js project and run

I have cloned a project from a Git Repo into my Mac, It only has project files not the node modules.
In GIT : Readme.md says run npm install to setup the project.
When I run the npm install I get below error list, how do I get through it?
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #vue/eslint-config-standard#6.1.0
npm ERR! Found: eslint-plugin-vue#8.7.1
npm ERR! node_modules/eslint-plugin-vue
npm ERR! dev eslint-plugin-vue#"^8.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint-plugin-vue#"^7.0.0" from #vue/eslint-config-standard#6.1.0
npm ERR! node_modules/#vue/eslint-config-standard
npm ERR! dev #vue/eslint-config-standard#"^6.1.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: eslint-plugin-vue#7.20.0
npm ERR! node_modules/eslint-plugin-vue
npm ERR! peer eslint-plugin-vue#"^7.0.0" from #vue/eslint-config-standard#6.1.0
npm ERR! node_modules/#vue/eslint-config-standard
npm ERR! dev #vue/eslint-config-standard#"^6.1.0" 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 /Users/dev/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dev/.npm/_logs/2022-06-23T23_17_06_125Z-debug-0.log
This bug seems current, to reproduce it :
vue create hello-world
Vue CLI v5.0.8
...
npm install
and if you do : rm -rf node_modules then npm install you get error :
npm ERR! While resolving: #vue/eslint-config-standard#6.1.0
And no solution till now
thank you
What I did to get rid of the problem was removing the:
"eslint-plugin-vue": "^8.0.3",
line in the package.json file.
from the "devDependencies" section.
Then I did an
npm install
to download all the dependencies. And after that I downloaded the eslint Vue plugin seperatly with the Vue CLI.
vue add eslint
I don't know if this is the solution to the problem. I just wanted to help.

#react-native-community/datetimepicker install throwing error

I tried to install datetime picker for my react-native (expo) project but, when i try to install it;
expo install #react-native-community/picker
It throws error;
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! react#"16.13.1" from the root project
npm ERR! peer react#">=16.8.3" from #react-native-community/datetimepicker#3.2.0
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"3.2.0" from the root project
npm ERR! 1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-native-windows#0.64.12
npm ERR! node_modules/react-native-windows
npm ERR! peer react-native-windows#">=0.62" from #react-native-community/datetimepicker#3.2.0
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"3.2.0" 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\irfan\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\irfan\AppData\Local\npm-cache\_logs\2021-06-30T13_38_37_968Z-debug.log
As per this error (if i got it right), this requires a different version of react (17.0.1) which when installed solves the problem but this version of the react is not supported by expo.
Please provide a solution which will be compatible with expo.
After searching for a whole day, i thought to post it here. But just after posting, i got an answer in my mind.
Why not to clone it directly from the github instead of installing it with expo or npm.
Did the same thing and now working fine.
This issue was also raised on github but it had no solutions.

React-navigation- dependencies (Error while install NPM navigation dependencies package installation)

when I install this package
1 . npm install #react-native-community/masked-view .
it shows error like this
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: Sample_pro#0.0.1
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! react#"17.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.0" from #react-native-community/masked-view#0.1.10
npm ERR! node_modules/#react-native-community/masked-view
npm ERR! #react-native-community/masked-view#"*" 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\HP\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\HP\AppData\Local\npm-cache_logs\2021-04-21T03_52_51_024Z-debug.log
-----How should I solve this problem-----
Ther error message is telling you that
your proj is using react # 17.0.1 version while #react-native-community/masked-view 0.1.10 has a dependency of react # 16.
To solve it, you can choose one of the followings:
upgrade #react-native-community/masked-view to the latest package which is accepting react#16 and react#17
downgrade your root project's react version to 16
please remove package-lock.json file and try to install again hope it will work.

Installing styled components failed in react native

I'm using react native 0.63.4 and react 16.13.1.
I try to install 'styled-components' with
npm install --save styled-components
and failed with these messages:
`code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: myproject#0.0.1
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! react#"16.13.1" from the root project
npm ERR! peer react#">= 16.8.0" from styled-components#5.2.1
npm ERR! node_modules/styled-components
npm ERR! styled-components#"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-dom#17.0.1
npm ERR! node_modules/react-dom
npm ERR! peer react-dom#">= 16.8.0" from styled-components#5.2.1
npm ERR! node_modules/styled-components
npm ERR! styled-components#"*" 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! `
I was not sure what the problems are.
Please if anyone can help me. Thanks.
UPDATE
https://github.com/npm/cli/issues/2120
Also there is a issue with npm resolving peer-dependencies, npm-CLI currently breaks standard NPM7 installs of several major dependencies, such as for example styled-component, your npm version is 7.+ also
Try downgrading to npm 6 or install another version of styled-components
or you can use yarn to install styled-components
yarn add styled-components
I ended up using yarn to instal styled-components, and it works.
yarn add styled-components
Have you tried using yarn instead of npm?