SyntaxError:您只能在启用“classProperties"插件时使用类属性 [英] SyntaxError: You can only use Class Properties when the 'classProperties' plugin is enabled

查看:41
本文介绍了SyntaxError:您只能在启用“classProperties"插件时使用类属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 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)

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

I have no idea why this is happening all of a sudden. It was working all fine before. I guess I deleted some config files by mistake while tinkering.

推荐答案

更新

他们已经更新了软件包,因此删除您的节点模块并重新安装它们.rm -rf node_modulesnpm install 更多信息

They have updated the package so remove your node modules and reinstall them. rm -rf node_modules and npm install More info

我正在从 开始使用.

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

它奏效了!

原创

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

npm 卸载巴比伦 &&npm install babylon@6.15.0或更新 package.json 文件以包含 "babylon": "6.15.0"

npm uninstall babylon && npm install babylon@6.15.0 or update the package.json file to include "babylon": "6.15.0"

这篇关于SyntaxError:您只能在启用“classProperties"插件时使用类属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆