SyntaxError: You can only use Class Properties when the 'classProperties' plugin is enabled
SyntaxError: You can only use Class Properties when the 'classProperties' plugin is enabled
当我使用 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.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"
在我的例子中(在 windows7 上),python 没有安装。安装 Python2 后,react-native init 命令运行良好。
当我使用 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.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"
在我的例子中(在 windows7 上),python 没有安装。安装 Python2 后,react-native init 命令运行良好。