S.Dan
S.Dan

Reputation: 1920

Module not found: Can't resolve 'react-native' error when adding SafeAreaView

I used the following commands to create a react app:

npm install react-native
npx create-react-app my-app
cd my-app
npm start

The I added the following line of code in the App.js and reloaded the browser.

import {SafeAreaView} from 'react-native';

But it keeps showing the error:

./src/App.js
Module not found: Can't resolve 'react-native' in '/Users/sdan/Documents/Projects/my-app/src'

Upvotes: 0

Views: 121

Answers (1)

Anhdevit
Anhdevit

Reputation: 2104

You are using react not react-native if you want to create and run react-native just flow document https://reactnative.dev/docs/environment-setup and then you can create react-native app like that:

npx react-native init AwesomeProject

Upvotes: 1

Related Questions