Bundling Failed React Native

When I typed in react-native run-android, the following error appeared:

Loading dependency graph, done.
error: bundling failed: SyntaxError in C:\Users\User\Desktop\nodejstest\mobile\node_modules\react-native\Libraries\Components\AccessibilityInfo\Accessib
ilityInfo.android.js: C:/Users/User/Desktop/nodejstest/mobile/node_modul
es/react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo.android
.js: Unexpected token, expected ; (19:5)
  17 | const TOUCH_EXPLORATION_EVENT = 'touchExplorationDidChange';
  18 |
> 19 | type ChangeEventName = $Enum<{
     |      ^
  20 |   change: string,
  21 | }>;
  22 |
 BUNDLE  [android, dev] ./index.js ░░░░░░░░░░░░░░░░ 2.6% (18/112), failed.

Been debugging this for couple of hours. Kinda new to React Native. How can I fix this ?

Please remove node_modules folder and run below commands:
npm install
npm start -- --reset-cache

Eventhough I had the latest react-native in my package.json installed, my react-native cli tool was out of date.
What I did was "react-native upgrade" and then I received prompt messages, that my .babelrc was outdated.
I confirmed all the prompts and now it works, I was stuck with this problem for 48 hours

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue