You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native执行run-android报错文件不存在,安装react-native-paper后出现

执行react-native run-android报错:Syntax Error None of these files exist: REACT NATIVE CLI

安装react-native-paper包后,执行react-native run-android启动服务时出现以下错误:

Syntax Error None of these files exist: REACT NATIVE CLI

Android模拟器截图:
Android模拟器截图

我正在为页面添加搜索栏,App.js代码如下:

import React from "react";
import { SafeAreaView } from 'react-native-safe-area-context';
import { Searchbar } from "react-native-paper";
import { Text, View, StyleSheet } from "react-native";

export default function App() {
  return (
    <>
      <SafeAreaView style={styles.container}>
        <View style={styles.search}>
          <Searchbar />
        </View>
        <View style={styles.list}>
          <Text>List</Text>
        </View>
      </SafeAreaView>
    </>
  )
}

package.json中的依赖信息:

{
  "name": "restaurantapp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-paper": "^5.1.2",
    "react-native-safe-area-context": "^4.4.1"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/runtime": "^7.12.5",
    "@react-native-community/eslint-config": "^2.0.0",
    "babel-jest": "^26.6.3",
    "eslint": "^7.32.0",
    "jest": "^26.6.3",
    "metro-react-native-babel-preset": "0.72.3",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

已尝试的解决方案:

  • 卸载并重装react-native-paper包
  • 执行--clean-cache命令清理缓存

问题仍未解决,求可行的修复方案。

内容的提问来源于stack exchange,提问作者Rohitt05

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 07:31:06