【RN v0.57.4】undefined 不是对象(评估 'warnings.filter')



说明

在现有 rn 项目中执行npm ireact-native run-android(iOS正常),运行成功,但产生错误并显示红屏:

undefined is not an object (evaluating 'warnings.filter')

反应原生版本:

React Native Environment Info:
System:
OS: macOS 10.14.5
CPU: (4) x64 Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz
Memory: 43.46 MB / 8.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 12.10.0 - /usr/local/bin/node
Yarn: 1.17.3 - ~/.yarn/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 26, 27, 28
Build Tools: 23.0.1, 26.0.1, 27.0.3, 28.0.2, 28.0.3
System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-26 | Google APIs Intel x86 Atom, android-27 | Intel x86 Atom_64, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5977832
Xcode: 11.3.1/11C505 - /usr/bin/xcodebuild
npmPackages:
react: ^16.6.0-alpha.8af6728 => 16.13.1
react-native: 0.57.4 => 0.57.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-demo-for-npm: 1.0.16
react-native-update-cli: 0.1.0

重现步骤

  1. 在现有项目中执行npm i
  2. 运行react-native run-android

预期成果

成功运行安卓没有任何错误。

我已经为这个问题搜索了许多解决方案,但不幸的是,最终没有任何解决方案。对此的任何帮助将不胜感激。提前非常感谢。

我认为您应该在代码库中找到warnings变量。如果它存在,那么错误可能是从该部分发生的。它可能是一个未定义的,所以你应该像

warnings && warnings.filter...

if(warnings) {
warnings.filter..
}

最新更新