开发服务器返回响应错误码:500 react-native
The development server returned response error code: 500 react-native
node.js window 错误:
错误:捆绑失败:错误:无法从 node_modules\@react-navigation\native\src\Scrollables.js
解析模块 react-native-gesture-handler
:在项目中找不到 react-native-gesture-handler。
我认为错误与 npm 或 yarn 的库有关。
App.js代码:
import React, {Component} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Button
} from 'react-native';
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation';
class FirstPage extends Component{
render(){
return(
<View>
<Text>This is the first page.</Text>
<Button onPress={()=>this.props.navigation.navigate('test')} title="Go to the second page"/>
</View>
)
}
}
class SecondPage extends Component{
render(){
return(
<View>
<Text>This is the second page.</Text>
<Button onPress={()=>this.props.navigation.navigate('home')} title="Go to the first page"/>
</View>
)
}
}
export default createStackNavigator({
home:FirstPage,
test:SecondPage
});
您只需安装 react-native-gesture-handler
,因为 react-navaigation
使用了它。因此,要获得更多解释,您可以阅读文档 https://reactnavigation.org/
您需要安装以下软件包以及 raeact 导航才能正常工作,
你可以通过
添加
yarn add react-navigation react-native-gesture-handler react-native-reanimated react-native-screens
或
npm i react-navigation react-native-gesture-handler react-native-reanimated react-native-screens
希望对您有所帮助。有疑问请随意
node.js window 错误:
错误:捆绑失败:错误:无法从 node_modules\@react-navigation\native\src\Scrollables.js
解析模块 react-native-gesture-handler
:在项目中找不到 react-native-gesture-handler。
我认为错误与 npm 或 yarn 的库有关。
App.js代码:
import React, {Component} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
Button
} from 'react-native';
import { createAppContainer } from 'react-navigation';
import { createStackNavigator } from 'react-navigation';
class FirstPage extends Component{
render(){
return(
<View>
<Text>This is the first page.</Text>
<Button onPress={()=>this.props.navigation.navigate('test')} title="Go to the second page"/>
</View>
)
}
}
class SecondPage extends Component{
render(){
return(
<View>
<Text>This is the second page.</Text>
<Button onPress={()=>this.props.navigation.navigate('home')} title="Go to the first page"/>
</View>
)
}
}
export default createStackNavigator({
home:FirstPage,
test:SecondPage
});
您只需安装 react-native-gesture-handler
,因为 react-navaigation
使用了它。因此,要获得更多解释,您可以阅读文档 https://reactnavigation.org/
您需要安装以下软件包以及 raeact 导航才能正常工作,
你可以通过
添加yarn add react-navigation react-native-gesture-handler react-native-reanimated react-native-screens
或
npm i react-navigation react-native-gesture-handler react-native-reanimated react-native-screens
希望对您有所帮助。有疑问请随意