gpt4 book ai didi

javascript - Android 的错误代码 : 500 on react native 0. 56

转载 作者:行者123 更新时间:2023-12-01 01:49:19 26 4
gpt4 key购买 nike

image 1

我的项目是一个新的空 react native 项目。构建时一切都很酷,但在 Android 设备上我每次都会遇到红色的“错误 500”屏幕。我已经尝试过这段代码:

yarn remove babel-preset-react-native
yarn add babel-preset-react-native@2.1.0

到目前为止没有任何变化!

我尝试将 React Native 降级到 55.4 - 没有变化!清洁捕获物 - 没有变化!顺便说一句,这是我的 App.js:

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';

const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});

type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

index.js:

import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

这是我的 package.json:

{
"name": "app",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.4.1",
"react-native": "0.56.0"
},
"devDependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "5",
"jest": "23.5.0",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}

Windows 10 64 位网络 Storm

最佳答案

最新的 React Native 版本似乎存在一些问题。

使用以下命令创建项目。

react-native init --version="0.54.0" ProjectName

一定会成功的。

关于javascript - Android 的错误代码 : 500 on react native 0. 56,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51682163/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com