Reputation: 49
I installed react-native
and the global cli.
But when I run npm start
, I'm having this error:
Cannot find module 'react-native'
Here is my App.js
file. Thank you...
import React from "react";
import { SafeAreaView, View, Text } from "react-native";
function App() {
return (
<SafeAreaView
style={{
flex: 1,
alignItems: "center",
justifyContent: "center",
}}
>
<View
style={{
flex: 1,
alignItems: "center",
justifyContent: "center",
}}
>
<View style={{ flex: 3 }}>
<Text>Kayıt Listesi</Text>
</View>
</View>
</SafeAreaView>
);
}
export default App;
Upvotes: 2
Views: 11464
Reputation: 9733
Execute the following steps:
node_modules
directory.npm install
.npm start
.The command npm install
install everything your project needs into the node_modules
directory.
If this does not help, try to add react-native
individually by executing the command npm install react-native --save
.
It is usually a good idea to initialize a new project using npm init
, which creates a package.json
file in which npm
stores names and versions of all installed packages.
Edit: After we have investigated the whole stack trace it is apparent that we need to install react-native-web
via the command npm install react-native-web
.
Upvotes: 5