首页 > 解决方案 > 运行 React Native 应用程序时出错 - 未知选项

问题描述

所以我一直在尝试学习应用程序开发的本机反应,并且我一直在处理许多错误,试图让一个非常简单的应用程序运行。我不得不删除 node_modules 并重新安装纱线。现在,在解决了我之前遇到的巨大错误之后,现在当我尝试运行它时,我的 cmd 中出现以下错误:

error: unknown option `--assetPlugins'

Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
error Command failed with exit code 1.

我从今年早些时候在这里发现了一个类似的问题,但解决方案似乎是正确更新了 expo 版本,但我的 expo 是几天前在我开始教程时安装的。我的 app.js 文件中唯一的代码如下:

import React, {useState} from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';

export default function App() {
  const[outputText, setOutputText] = useState('New State');
  return (
    <View style={styles.container}>
<Text>{outputText}</Text>
      <Button title="Change Text" onPress={() => setOutputText('the text changed')}/>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});

所以我不知道如何调试这个,我是全新的反应。在此先感谢您的帮助。我对反应感到非常沮丧,我已经尝试了一个多星期来完成一个简单的教程,而且我在每一步都遇到错误......

标签: javascriptreactjsreact-nativeexpo

解决方案


推荐阅读