加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

使用CLI初始化react-native app时出现语法错误

发布时间:2020-12-15 05:04:09 所属栏目:百科 来源:网络整理
导读:当我使用react-native init MyApp初始化应用程序时,我收到以下语法错误 SyntaxError: /Users/MyAccount/RNProjects/app/node_modules/react-native/packager/react-packager/src/node-haste/index.js: You can only use Class Properties when the 'classPro
当我使用react-native init MyApp初始化应用程序时,我收到以下语法错误
SyntaxError: /Users/MyAccount/RNProjects/app/node_modules/react-native/packager/react-packager/src/node-haste/index.js: You can only use Class Properties when the 'classProperties' plugin is enabled. (389:2)
  387 |   }
  388 |
> 389 |   static Cache;
      |   ^
  390 |   static Module;
  391 |   static Polyfill;
  392 |   static getAssetDataFromName;
    at Parser.pp$5.raise (/Users/MyAccount/RNProjects/app/node_modules/babylon/lib/index.js:4380:13)

我不知道为什么会突然发生这种情况.之前一切正常.我想我在修补时错误地删除了一些配置文件.

更新

他们已更新软件包,因此请删除节点模块并重新安装. rm -rf node_modules和npm install More info

我从getting started开始安装AwesomeProject.

$rm -rf AwesomeProject/
$react-native init AwesomeProject

它奏效了!

原版的

已提出问题:https://github.com/facebook/react-native/issues/12542

npm uninstall babylon&& npm install babylon@6.15.0或更新package.json文件以包含“babylon”:“6.15.0”

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读