I'm following the setup instructions from the React Native Documentation page, on my M1 Macbook Pro. I have previously worked on React projects and was able to create and run React Native Expo projects previously on the same machine.
I followed the instructions to the letter, but when I arrived at the 'Create A New Application" section, using the npx react-native init AwesomeProject command, the new project creation failed. Here are the error message outputted on the Terminal:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react-native#0.66.4
npm ERR! node_modules/react-native
npm ERR! peer react-native#"*" from #react-native-community/cli#6.3.1
npm ERR! node_modules/#react-native-community/cli
npm ERR! #react-native-community/cli#"^6.0.0" from react-native#0.66.4
npm ERR! react-native#"0.69.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! react-native#"0.69.2" 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.2
npm ERR! node_modules/react-native
npm ERR! react-native#"0.69.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.
I tried to uninstall react-native and install it back but couldn't find a proper instruction on the net to do that. How can I just scrape the previously installed react-native (judging from the error message, i got RN#0.66.4, when I want to use the latest RN) and install a fresh, latest react native?
if you are on Mac and your node version is 18.. which Is latest but not greatest.. you need to download 16.. the stable one.
Step-1
brew uninstall node;
# or `brew uninstall --force node` which removes all versions
brew cleanup;
rm -f /usr/local/bin/npm /usr/local/lib/dtrace/node.d;
rm -rf ~/.npm;
Step 2 - and install it from node site by downloading the binary
Step 3 - just check the node version again if you have 16..
then you can try creating the react native project once again.
Please let us know if it worked for you. Wish you luck!!
In addition to what the answer suggests, you can do brew install node#16 to install this particular version instead of manually downloading the binary.
If installing node version 16 doesn't work for you ensure you update npm by running sudo npm update -g.
Related
When I try to install the react-burger-menu thingy on react using the npm install react-burger --save, it gives out this error and I cannot continue my project:
npm ERR! While resolving: MYPROJECT
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#">=0.14.0 <17.0.0" from react-burger-menu#2.9.2
npm ERR! node_modules/react-burger-menu
npm ERR! react-burger-menu#"2.9.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!
How can I successfully install the burger menu?
Thanks in advance.
Package You're trying to download in only available for react version lesser than or equal to 17. You can use this package by downgrading from React 18 to React 17 by,
npm install react#17.0.0 react-dom#17.0.0
Or alternatively :
You can use another package for react burger thing ;-). May be I can help for alternate package ?
Im trying to install #tsamantanis/react-glassmorphism in my project.
npm install --save #tsamantanis/react-glassmorphism
and i see this
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cpprojectmovie#0.1.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#"^17.0.1" from #tsamantanis/react-glassmorphism#1.1.2
npm ERR! node_modules/#tsamantanis/react-glassmorphism
npm ERR! #tsamantanis/react-glassmorphism#"*" 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\mintam\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\mintam\AppData\Local\npm-cache\_logs\2022-09-22T03_24_18_239Z-debug-0.log
please help me to find the solution. thank you in advance
The punchline is this:
npm ERR! peer react#"^17.0.1" from #tsamantanis/react-glassmorphism#1.1.2
Peer dependency means the package you're trying to install expects the "peer" (in this case react#"^17.0.1 package) to be in the same project.
This means the package you're trying to install react-glassmorphism's latest version 1.1.2 expects your React version to be at least v17.
The solution is either upgrading your project's React version to v17, or installing an older version of react-glassmorphism package.
Look at the version history of the package and find the version that supports earlier version of React and install it:
npm i --save react-glassmorphism#<version here>
I run my React app using npm using the following command npm run start-rewired.
However, in doing so, I'm getting the below error:
> project#0.1.0 start-rewired
> react-app-rewired start
npm ERR! code ENOENT
npm ERR! syscall spawn C:\Program Files\git\bin\bash.exe
npm ERR! path C:\project
npm ERR! errno -4058
npm ERR! enoent spawn C:\Program Files\git\bin\bash.exe ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\{my-user}\AppData\Local\npm-cache\_logs\2022-03-16T15_34_33_074Z-debug-0.log
I have followed a lot of the suggestions online, including deleting the node_modules as well as clearing the npm cache using npm cache clean
I'm running npm run start-rewired in the root path of my project. I should mention that I use yarn to install the dependencies and packages, and that running yarn install worked fine.
I'm really stuck and I'm unsure on what to do at this point.
EDIT I should also mention that this project starts up fine on a different machine with the same node and npm versions.
This issue was due to the fact that npm couldn't find the bash.exe location for git. It was looking here C:\Program Files\git\bin\bash.exe but git was installed in a different location. So what I did was uninstall and reinstall git in the above location and it resolved the issue.
I have been trying to download a template to start customizing it. Upon downloading it, one is supposed to install all local dependencies using npm install or yarn install. I have done both of those and I have gotten the same error both times. Moreover I have tried using the same command with --force and --legacy-peer-deps, as advised in the error message. I found a GitHub issue discussing this precise problem and some other stack overflow threads. I have tried everything I have come across, and it is just not working. Moreover I have installed the recommended version of node, so that is not the problem either, as suggested in a different thread.
The error message can be seen below.
While resolving: #mui/material#5.2.0
npm ERR! Found: #emotion/react#11.4.1
npm ERR! node_modules/#emotion/react
npm ERR! #emotion/react#"11.4.1" from the root project
npm ERR! peer #emotion/react#"^11.0.0-rc.0" from #emotion/styled#11.3.0
npm ERR! node_modules/#emotion/styled
npm ERR! #emotion/styled#"11.3.0" from the root project
npm ERR! peerOptional #emotion/styled#"^11.3.0" from #mui/material#5.2.0
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"5.2.0" from the root project
npm ERR! 1 more (#mui/icons-material)
npm ERR! 1 more (#mui/styled-engine)
npm ERR! 1 more (#mui/styled-engine)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional #emotion/react#"^11.5.0" from #mui/material#5.2.0
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"5.2.0" from the root project
npm ERR! peer #mui/material#"^5.0.0" from #mui/icons-material#5.2.0
npm ERR! node_modules/#mui/icons-material
npm ERR! #mui/icons-material#"5.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #emotion/react#11.7.1
npm ERR! node_modules/#emotion/react
npm ERR! peerOptional #emotion/react#"^11.5.0" from #mui/material#5.2.0
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"5.2.0" from the root project
npm ERR! peer #mui/material#"^5.0.0" from #mui/icons-material#5.2.0
npm ERR! node_modules/#mui/icons-material
npm ERR! #mui/icons-material#"5.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.
The template: https://www.creative-tim.com/product/material-dashboard-react?ref=readme-mdr#
GitHub issue: https://github.com/creativetimofficial/material-dashboard-react/issues/171
Thanks in advance.
The problem is that the specific version of #emotion/react used in the template, is not working anymore.
To solve the problem I went to the package.json and changed the version from 11.4.1 to 11.5.0 manually. Seems that the 11.5.0 solves the problem with the template used.
upgrade your version from package.json file and run again "npm install" command
I received this error while not in the folder of my react app. Cd into it and should be good but I am positive you found this answer by now or stumbled upon it like me. Best wishes
In React Native application to make a navigation need to install #react-navigation/stack using npm install #react-navigation/stack and I have tried it and failed each and every times.
NPM version: 7.19.1
Node version: v15.14.0
Expo version: 4.8.1
After running npm install #react-navigation/stack this command I have faced the below error is given,
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: #react-navigation/native#3.8.4
npm ERR! node_modules/#react-navigation/native
npm ERR! #react-navigation/native#"^3.8.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #react-navigation/native#"^6.0.0" from #react-navigation/stack#6.0.1
npm ERR! node_modules/#react-navigation/stack
npm ERR! #react-navigation/stack#"*" 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 /home/imdadul/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/imdadul/.npm/_logs/2021-08-04T07_46_39_555Z-debug.log
Note: Please concern the attached file and who have knowledge about this will be helpful to help me. Advanced Thanks!
You have dependency conflict which means that the dependency is incorrect and potentially broken. You could try to run the command with --force, or --legacy-peer-deps and see if that helps.
npm install #react-navigation/stack --force
or
npm install #react-navigation/stack --legacy-peer-deps
Sometimes removing the node_modules and package-lock.json file and run the command npm install #react-navigation/stack or try npm cache clean --force can work.