As said by the error, in react-navigation
version 4, all navigators have been moved to separate repos so you have to install them separately.
For the StackNavigator
you have to install react-navigation-stack
using:
npm i react-navigation-stack //or yarn add react-navigation-stack
after that, go to the file where you define createStackNavigator
and change:
import { createStackNavigator } from 'react-navigation'
to:
import { createStackNavigator } from 'react-navigation-stack'
This error may happen because your friend used react-navigation v. 3 but in your package.json
it's using a react-navigation
version >3. When you did npm install
it downloaded the latest version of react-navigation (that updated last week to version 4 with those changes)
The same goes for the other navigators.
SOURCE: https://reactnavigation.org/docs/en/stack-navigator.html