Reputation: 75
I'm trying to create a new react native app with react navigation.
I did the following:
1.) create-react-native-app myAppName
2.) cd myAppName/
3.) npm install --save react-navigation
4.) Expecting successful installation of react-navigation but instead i get:
C:\Users\Maima\Documents\GitHub\React\test>npm install --save react-navigation
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\jest as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\jest
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\rimraf as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\rimraf
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\t
est\node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\uuid as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\test\
node_modules\uuid
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver.cmd as it wasn't installed by C:\Users\Maima\Documents\GitHub\React
\test\node_modules\semver
npm WARN rm not removing C:\Users\Maima\Documents\GitHub\React\test\node_modules
\.bin\semver as it wasn't installed by C:\Users\Maima\Documents\GitHub\React\tes
t\node_modules\semver
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of react@* but none is i
nstalled. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but no
ne is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is ins
talled. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but none
is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-nati
ve@* but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react@* but none is
installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of react-native@* but
none is installed. You must install peer dependencies yourself.
+ [email protected]
added 8 packages, removed 973 packages and updated 20 packages in 259.667s
Please Help, Cant npm start my React Native App.
Upvotes: 2
Views: 12786
Reputation: 1
If you are running your expo server, stop the server and continue npm install --save react-navigation . It worked for me.
Upvotes: 0
Reputation: 5065
Followed the steps but got error with npm install
. I am also using Expo (as mentioned by @vbandrade) and there are also problems with that. First of all, i think react-navigation
is changing a lot. After trying a lot (before applying the solution in the accepted answer), i installed react-navigation
and its dependencies multiple times and it worked at one time when i first ran;
npm install react-navigation
then
npm install @react-navigation/native
(which doesn't make too sense for me as that gets auto installed with react-navigation). Then i ran;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
for installing dependencies and it worked. Honestly i didn't understood anything that how it worked. So for the sake of learning i installed the project and reinstalled it with expo and after that nothing worked. So i applied @vbandrade's answer but it was giving some more errors after i ran npm install
.
To get rid of these errors, i found another solution (from stackoverflow). Here is that solution.First of all delete node_modules
folder and package-lock.json
file and close your editor or any other file where your project is open (because node doesn't install some packages if the project is open).
Then,
First run this command;
npm cache clean --force
Then,
npm install
And then;
npm install react-navigation
And at last install the dependencies;
npm install react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view
Run your project;
If using expo;
expo start
Errors must be gone now.
Upvotes: 0
Reputation: 11
The same error appeared when I tried to run npm install --save react-navigation
. Turns out I needed to run npm install
prior to npm install --save react-navigation
.
Upvotes: 1
Reputation: 91
It can be solved by running a npm install
command again and reinstall the npm install --save react-navigation
command.
Upvotes: 7
Reputation: 4498
They aren't errors, just warnings telling you that some peer dependencies that navigation relies on aren't installed. Based on your commands, you need to run npm install
or yarn install
to install all the packages. Creating the app with create-react-native
app give you a list of packages but you have to actually install them with npm install
. If something funky happens, do what @vbandrade suggested and hose your node_modules and package.lock
, then do a fresh npm install
Upvotes: 2
Reputation: 2662
I cant comment because I dont have the points, so heres a tentative answer with the info at the moment:
I had similar issue when running Expo on Windows. to solve I had to close XDE and reinstall.
if that's not enough, delete the "node_modules" folder and run "npm install".
Upvotes: 4