installing react-navigation with npm gives an error - react-native

I am aware that there are already questions about this but they didn't work and most of them are for create-react-native-app but I am using expo.
I run npm install react-navigation and it gives me this error:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: file-uri-to-path#1.0.0 (node_modules\file-uri-to-path):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'C:\Users\yaelp\Downloads\meals-cat\node_modules\file-uri-to-path' -> 'C:\Users\yaelp\Downloads\meals-cat\node_modules\.file-uri-to-path.DELETE'
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\Users\yaelp\Downloads\meals-cat\node_modules\hoist-non-react-statics
npm ERR! dest C:\Users\yaelp\Downloads\meals-cat\node_modules\.hoist-non-react-statics.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\yaelp\Downloads\meals-cat\node_modules\hoist-non-react-statics' -> 'C:\Users\yaelp\Downloads\meals-cat\node_modules\.hoist-non-react-statics.DELETE'
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\yaelp\AppData\Roaming\npm-cache\_logs\2020-10-01T17_02_25_868Z-debug.log

Try to install all dependencies (from the documentation of react-navigation).
Run:
expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context #react-native-community/masked-view

I hope you resolved your issue by now (more than a month has passed since you posted the question). For those who might get it (like I did), here are some possible solutions:
Install react-navigation with yarn:
In the official react-navigation docs there is a yarn install command:
yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context #react-native-community/masked-view
Try deleting package-lock.json file and then try installing react-navigation with npm again
Killing your app and then trying to install react-navigation,
Deleting your node_modules and do npm i again,
Try uninstalling node, npm and everything with it (and reinstalled everything afterwards of course).
I got these solutions from this github issue. I hope one of them will help.

Try to use expo install react-navigation as you are using expo.
If you need to use npm, try:
npm install react-navigation --force

Try to run npm install, then npm install #react-navigation/native from reactnavigation

Related

React Native Navigation Installing

Below is the error while installing react native navigation. help me to sort out this problem:
npm install -- save react-navigation
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path E:\ReactNative\logwithfirebase\node_modules\#react-navigation\core\node_modules\react-is
npm ERR! dest E:\ReactNative\logwithfirebase\node_modules\#react-navigation\core\node_modules\.react-is.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename 'E:\ReactNative\logwithfirebase\node_modules\#react-navigation\core\node_modules\react-is' -> 'E:\ReactNative\logwithfirebase\node_modules\#react-navigation\core\node_modules\.react-is.DELETE'
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\asadc\AppData\Roaming\npm-cache\_logs\2022-08-09T08_24_34_577Z-debug.log
Here is the complete Installation for React Native Navigation
Install the React Navigation by following command.
npm install #react-navigation/native
After the installation Follow next steps:
1.npm install react-native-screens react-native-safe-area-context
If this doesn't work then
Remove the dependencies #react-navigation/native from package.json
Please remove your
node_modules
package-lock.json
and follow the same process again.
Thanks!!
Do you mean to run this ?
npm install #react-navigation/native
Ref:
https://reactnavigation.org/docs/getting-started/
If you work on mac, that might be the reason. And you should run
yarn add #react-navigation/native

ERESOLVE unable to resolve dependency tree - for #mui/material

I am trying to install material UI as described on the home page, but I get a dependency tree error :
C:\dev\shape-shop-front-end>npm install #mui/material
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app#0.1.0
npm ERR! Found: react#16.14.0
npm ERR! node_modules/react
npm ERR! react#"^16.13.1" from the root project
npm ERR! peer react#">=16.8.0" from #emotion/react#11.7.1
npm ERR! node_modules/#emotion/react
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"*" from the root project
npm ERR!
In my package.json I have "react": "^16.13.1" .
As I understand it, this error is saying that a MUI package needs react 16.8.0
Indeed, a sub-dependency of it, named #emotion/react#11.7.1, has listed the following peer dependencies you have to meet:
"peerDependencies": {
"#babel/core": "^7.0.0",
"react": ">=16.8.0"
}
source: https://github.com/emotion-js/emotion/blob/main/packages/react/package.json
I think this has to do with how new versions of NPM deal with peer dependencies: https://github.blog/2021-02-02-npm-7-is-now-generally-available/
As your react version seems OK, I would go with this suggestion:
You have the option to retry with --force to bypass the conflict or --legacy-peer-deps command to ignore peer dependencies entirely (this behavior is similar to versions 4-6).
Try using --force.
That's what worked for me
npm install #mui/material --force
I have a feeling it's a dependency conflict that came with the recent React upgrade...
Looks like updating dependencies in package.json is the only way to make this happen now.
$ npm install -g npm-check-updates
$ ncu -u
$ npm install
or see how to update each dependency in package.json
after updating, now try to install your material UI.
use this command instead
npm install #material-ui/core
If you're using it for the icon, then use this
npm install #material-ui/core #material-ui/icons
Try using
npm install #material-ui/core --force

Craco - Could not resolve dependency error

I am trying to setup TailwindCSS in my Create-React-App project and I am trying to install craco so that I need not eject my CRA
When I run the following command npm install #craco/craco, I get unable to resolve dependency tree error. Below is the detail of the error. What should I do? Thanks
npm install #craco/craco
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: exchange#0.1.0
npm ERR! Found: react-scripts#3.4.3
npm ERR! node_modules/react-scripts
npm ERR! react-scripts#"3.4.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-scripts#"^4.0.0" from #craco/craco#6.1.1
npm ERR! node_modules/#craco/craco
npm ERR! #craco/craco#"*" 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!
This works for me
npm install #craco/craco --save --legacy-peer-deps
With the below line you can also set --legacy-peer-deps permanently as a config option. Try to avoid this as you need to see which npm library/libraries in your project is/are having dependency issues.
npm config set legacy-peer-deps true
I've updated my package react-scripts to the latest version 4.x.
by running this command :
npm i react-scripts#latest
then lo and behold, I was able to install craco successfully.
Run this; it worked for me:
npm config set legacy-peer-deps true
Use yarn add, it would solve this for you, you don't need to do anything for the react-scripts version.
I think the error has to do with the dependency tree.
You have react-scripts#3.4.3 but #craco/craco requires react-scripts#4.0.0.
Simply run npm i react-scripts#4.0.0 and create craco.config.js file
i update my react app and then installed craco 5.05v
In my case using node v16.15.1 raising this error.
I resolved it by using node v16.13.1 with fixing the version in package.json
"engines": {
"node": "16.13.1"
},
You can also resolve by using yarn not npm.
Related issue:
Didn't want to upgrade react-scripts
So tried downgrading craco
It worked fine:
Commands that worked fine are below:
npm uninstall -g craco
npm uninstall -g #craco/craco
npm i -g craco#0.0.3
npm i -g #craco/craco#6.4.3
package.json contents:
"react-scripts": "^4.0.3",
"#craco/craco": "^6.4.3",
"craco": "^0.0.3",
If you are changing package.json then do:
npm i
npm install -f
Could help here.

cannot install #material-ui/core using npm

I tried to install #material-ui/core librabry but then npm throws the error below
I used the
npm install #material-ui
command
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: school-demo#0.1.0
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.8.0" from #material-ui/core#4.11.0
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"*" 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/freduah/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/freduah/.npm/_logs/2020-11-02T14_50_03_045Z-debug.log
freduah#freduah:~/school-demo$ ```
MaterialUI 4 doesn't support React 17 yet. Please check the issue created on github https://github.com/mui-org/material-ui/issues/23306.
You can try to install it by force by adding '-f':
npm install -f #material-ui/core
I had come across the same problem. These worked for me:
For core: npm -f install #material-ui/core
For icons: npm -f install #material-ui/icons
you can downgrade your react, it worked for me by this command:(I downgrade from v17)
npm install --save react#16.13.0 react-dom#16.13.0
Material UI is using emotion as a styling engine by default. If you want to use styled-components instead, run:
try to use this
npm install #mui/material #mui/styled-engine-sc styled-components
i highly recommend to read the document in thar website and not from npm
npm install #mui/material #emotion/react #emotion/styled
worked for me. Which I found on https://mui.com/
check your react versian, MaterialUI 4 doesn't support React 17. you can change youre version by
npm install --save react#16.13.0 react-dom#16.13.0
make sure Assuming you're using npm/yarn or another node package manager, dependency versions are listed in package.json.
Search for the react and react-dom packages under dependencies (or devDependencies) and replace their versions with 16.13.0. Then run npm install or yarn or whatever package manager you're using. This should be enough to downgrade to React 16.
Try
yarn add #material-ui/core & yarn add #material-ui/core
React 17 dont support material UI install previous versions or use yarn It will take some time but work perfectly fine
This worked for me
npm install -force #material-ui/core
Problem: npm install #material-ui/core
Solution:
npm install #mui/material #emotion/react #emotion/styled
OR
yarn add #mui/material #emotion/react #emotion/styled
npm install -f #material-ui/core
or
npm install #mui/material #emotion/react #emotion/styled --legacy-peer-deps
or You can downgrade react
npm install --save react#16.13.0 react-dom#16.13.0

Cannot install react navigation ({react native})

Cannot install react navigation, error is as below,
F:\Test2>npm install --save react-navigation
npm WARN #babel/plugin-check-constants#7.0.0-beta.38 requires a peer of #babel/core#7.0.0-beta.38 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-screens#1.0.0-alpha.9 requires a peer of react#16.0.0-alpha.6 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-screens#1.0.0-alpha.9 requires a peer of react-native#^0.44.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'F:\Test2\node_modules\.staging\fsevents-db169078\node_modules\nopt' -> 'F:\Test2\node_modules\.staging\nopt-ec00ee2d'
npm ERR! path F:\Test2\node_modules\hoist-non-react-statics
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'F:\Test2\node_modules\hoist-non-react-statics' -> 'F:\Test2\node_modules\.hoist-non-react-statics.DELETE'
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\usman\AppData\Roaming\npm-cache\_logs\2018-09-13T04_40_04_090Z-debug.log
Any help would be appreciated
First try
npm install -g react-navigation
Or next :
Try installing
npm install #react-navigation/native
First take a backup of all the dependencies in node modules.
Take information about package.json
with this file u can able to know which dependcies are already install if require u can reinstall npm then again do npm install#react-navigation/native
It seems the hoist-non-react-statics package is incorrect. So you could re-install it or re-install the whole node_modules.
First of all, backup your node_modules folder. This is very important!
Then delete node_modules folder and re-install the npm packages with npm install.
After above operation, try installing react-navigation again.