【问题标题】:The development server returned response error code: 500 react-native开发服务器返回响应错误码:500 react-native
【发布时间】:2019-12-06 07:02:15
【问题描述】:

node.js 窗口上的错误: 错误:捆绑失败:错误:无法从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
});

【问题讨论】:

标签: javascript react-native npm navigation yarnpkg


【解决方案1】:

您需要安装以下软件包以及 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

希望对您有所帮助。如有疑问,请随意

【讨论】:

    【解决方案2】:

    您只需要安装react-native-gesture-handler,因为react-navaigation 使用了它。因此,有关更多解释,您可以阅读文档https://reactnavigation.org/

    【讨论】:

    • 是的。反应原生文档有答案。万分感谢! @Patrissol Kenfack
    猜你喜欢
    • 2020-04-29
    • 1970-01-01
    • 2021-09-16
    • 2017-06-07
    • 2022-01-11
    • 2017-04-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多