Dou*_*XXX 12 android react-native
我在我的android程序上使用React-Native,在打开我的项目后react-native run-android,发生了错误。同样的错误消息出现了两次。
Unexpected identifier '_classCallCheck'.import call expects exactly one argument
Unexpected identifier '_classCallCheck'.import call expects exactly one argument
no stack
no stack
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索并尝试了一些解决方案,但仍然无法解决。这是我发现的类似问题: https ://github.com/facebook/react-native/issues/23669
对于这个错误我已经尝试过:
gradlew cleanreact-native start --reset-cachenpm install -g react-native-cli这是我的开发环境:
Android:
AVD version: Android 7.0 with Play Store
System:
OS: Windows 10 10.0.19043
CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
Memory: 2.11 GB / 15.71 GB
Binaries:
Node: 10.16.0 - D:\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.9.0 - D:\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 28, 32
Build Tools: 28.0.3, 32.0.0
System Images: android-24 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 2020.3.0.0 AI-203.7717.56.2031.7935034
Visual Studio: Not Found
Languages:
Java: 1.8.0_232
npmPackages:
@react-native-community/cli: Not Found
react: 16.9.0 => 16.9.0
react-native: ^0.64.0 => 0.64.3
react-native-windows: Not Found
npmGlobalPackages:
*react-native*: Not Found
Run Code Online (Sandbox Code Playgroud)
伙计们,我刚刚解决了这个问题。这是链接。 https://github.com/babel/babel/issues/14139
从:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
Run Code Online (Sandbox Code Playgroud)
到:
module.exports = {
presets: [['module:metro-react-native-babel-preset', {
unstable_disableES6Transforms: true
}]],
};
Run Code Online (Sandbox Code Playgroud)
1.在您的终端中输入:
npm ls metro-config
Run Code Online (Sandbox Code Playgroud)
你会看到你的react-native版本需要metro-config版本
"metro": "^0.59.0",
"metro-core": "^0.59.0",
"metro-react-native-babel-preset": "^0.59.0",
Run Code Online (Sandbox Code Playgroud)
resetCache: true,
Run Code Online (Sandbox Code Playgroud)
在你的 Metro.config.js 中
| 归档时间: |
|
| 查看次数: |
11325 次 |
| 最近记录: |