native_modules.gradle 安装 react-redux 后文件正在删除

native_modules.gradle file is deleting as soon as react-redux is installed

我已经为我的项目在 React Native 中创建了一个应用程序。当我将我的项目文件复制到应用程序文件夹中然后 运行 应用程序它说在 node_module 中 react-redux 不存在然后我在我的应用程序文件夹中使用 npm install react-redux@7.0.3 安装了 react-redux当我在这个项目的命令提示符中 运行 run-android 命令时,它告诉我 - Could not read script 'E:\AppFolder\MyApp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' as it does not exist.

之后,我擦除了模拟器和运行 run-android的数据,但它仍然给我同样的错误,应用程序没有安装在模拟器中。

这是命令提示符显示的错误:

info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
Starting a Gradle Daemon, 2 incompatible and 1 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* Where:
Settings file 'E:\AppFolder\MyApp\android\settings.gradle' line: 4

* What went wrong:
A problem occurred evaluating settings 'TribeBond'.
> Could not read script 'E:\AppFolder\MyApp\node_modules\@react-native-community\cli-platform-android\native_modules.gradle' as it does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 10s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.```

这里我按照以下步骤来解决我的问题-

  1. 我构建了一个新应用程序,并使用 react-native run-android 命令 运行 它。
  2. 然后我一一安装了所有的依赖,准备在应用中使用
  3. 然后在项目中运行npm install命令
  4. 之后,我使用 react-native run-android 重新构建了应用程序。
  5. 还有多田!该应用程序已重新构建,没有任何错误。