SyntaxError: You can use class properties only if the classProperties plugin

I get the following syntax error when initializing an application using 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 happens all of a sudden. Everything used to work fine before. I think I deleted some configuration files by mistake while working.

+5
source share
2 answers

Update

They updated the package, so remove the node modules and reinstall them. rm -rf node_modules and npm install Additional information

I installed AwesomeProject from the beginning .

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

And it worked!

Original

The problem was filed: https://github.com/facebook/react-native/issues/12542

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

+3
source

In my case (on windows7), python was not installed. After installing Python2, the reaction init-init command works fine.

0
source

Source: https://habr.com/ru/post/1264626/


All Articles