'I need to download react-navigation and using the command npm i @react-navigation/native and it is showing an error

PS E:\React Native\contacts> npm i @react-navigation/native npm WARN [email protected] requires a peer of @babel/preset-env@^7.1.6 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react@^16.0.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself. npm WARN [email protected] requires a peer of react@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself. npm WARN @react-navigation/[email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself. npm WARN @react-navigation/[email protected] requires a peer of react@* but none is installed. You must install peer dependencies yourself.

npm ERR! code ENOENT npm ERR! syscall rename npm ERR! path E:\React Native\contacts\node_modules@react-navigation\core\node_modules\react-is npm ERR! dest E:\React Native\contacts\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:\React Native\contacts\node_modules@react-navigation\core\node_modules\react-is' -> 'E:\React Native\contacts\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\Hello\AppData\Roaming\npm-cache_logs\2021-06-10T04_29_31_173Z-debug.log



Solution 1:[1]

The reason behind this is that npm deprecated [auto-installing of peerDependencies] since npm@3, so required peer dependencies like babel-core and webpack must be listed explicitly in your package.json.

All that you need to do is to install babel-core.

https://github.com/npm/npm/issues/6565

Solution 2:[2]

I think there is running android emulator, try to close all of android related consoles and retry the installation.

Solution 3:[3]

the solution of error to install NPM navigation dependencies packages: choose one of these!

1: upgrade @react-native-community/masked-view to the latest package which is accepting by react@16 and react@17.

2: downgrade your root project's react version to 16

I hope this is helpful.

Solution 4:[4]

I solved this error.

just run the command as globally

npm install -g @react-navigation/native

May be it shows some warnings but still your package will be installed

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 himanshu sharma
Solution 2 Aljohn Yamaro
Solution 3 Khadim H.
Solution 4 Aasif Ali