昨天我的项目做得很好.但今天早上,在我再次try 运行它之后,它给了我以下错误:

error node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js: Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression". Run CLI with --verbose flag for more details.
TypeError: Property body[41] of BlockStatement expected node to be of a type ["Statement"] but instead got "AssignmentExpression"

不过,我不确定这是什么意思.我该如何解决这个问题?

推荐答案

显然,这可能是巴别塔的问题.将工作项目的node_模块中的文件夹@babel(特别是@babel/core)复制到新项目中,它会正常运行.

这可能是因为他们几个小时前做了一次更新.

您还可以从软件包中删除当前的@babel/core.json并安装此版本npm install --save-dev @babel/core@latest.

Or use this:
@babel file: https://drive.google.com/file/d/1-z_4H_z4x075unZqZD41WYUwY_hsrKox/view.

或者替换package.json文件中的以下代码,然后替换npm install.

"@babel/core": "~7.14.0",
"@babel/compat-data": "~7.14.0",
"@babel/generator": "~7.14.0",
"@babel/helper-compilation-targets": "~7.14.0",
"@babel/helper-create-class-features-plugin": "~7.14.0",
"@babel/helper-create-regexp-features-plugin": "~7.14.0",
"@babel/helper-member-expression-to-functions": "~7.14.0",
"@babel/helper-module-transforms": "~7.14.0",
"@babel/helper-replace-supers": "~7.14.0",
"@babel/plugin-transform-react-display-name": "~7.14.0",
"@babel/plugin-transform-runtime": "~7.14.0",
"@babel/types": "~7.14.0",

React-native相关问答推荐

错误:HostBody::get for prop NativeUnimoduleProxy中出现异常- Android虚拟设备(AVD)使用Expo测试React Native App时崩溃

原生react :顶部的滑块位置

如何将S的此API输出输出到平面列表中?控制台将数据及其可视记录到平面列表中,但我无法输出到平面列表中

GetStream:更改消息气泡背景

在 ReactNative 中调用 RCTDeviceEventEmitter.emit 时出错

没有找到 `React-fishhook` 的 podspec

试图注册两个同名的视图 RNGestureHandlerButton

如何在 ubuntu 上安装 facebook watchman?

如何使用 Typescript 在无状态组件上设置 navigationOptions

背景图像在react中不起作用

React native + redux-persist:如何忽略键(黑名单)?

是否可以将 Image.getSize 与静态图像文件一起使用?

我可以从react-native元素中删除 tvOS 吗?

expo 已过期卸载并再次运行以升级

无法解析模块react-native-reanimated

如何在 React Native 的 MapView 中设置标记

手动调用 React.PropTypes 验证 React native "^0.30.0"

React Native 项目,有时使用 expo start 获得连接 ECONNREFUSED 127.0.0.1:19001

NavigationActions.reset 不是函数吗?

将 colored颜色 变量导入我的样式