Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type

I'm getting the following error from a few different libraries in my project, after adding the "stage-2" preset to my .babelrc. (Thats my assumption atm)

e.g. from the DatePicker class in React Native:

node_modules/react-native/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js: You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type

How can I resolve this error?

I'm using React Native 0.31 and

  "devDependencies": {
    "babel-preset-react-native-stage-0": "^1.0.1",
    "babel-preset-stage-2": "^6.17.0"
  },
like image 585
Adamski Avatar asked Oct 06 '16 11:10

Adamski


4 Answers

I too ran into this. Solved by updating my babel-core version by changing the entry in package.json to the latest (at the time of this writing)

// package.json
...
"babel-core": "6.17.0",
...

then running

rm -r node_modules/babel* && npm i
like image 77
Harry Moreno Avatar answered Oct 25 '22 02:10

Harry Moreno


I had the same issue after updating babel-core and some babel plugins. In my case it was fixed by updating babel-cli (globally installed with npm), which was a few versions behind and not using the right babel-core version.

like image 31
Thomas Roch Avatar answered Oct 25 '22 01:10

Thomas Roch


I encountered this after an npm update, struggled for several hours to find a fix, but ultimately solved it via rm -rf node_modules && npm install. I hate npm.

like image 36
Benjamin Riggs Avatar answered Oct 25 '22 00:10

Benjamin Riggs


I found this issue is caused by a lower version babel-types, so the solution is just:

npm install babel-types

or a clean npm install:

git clean -fdx
npm install
like image 25
Li Zheng Avatar answered Oct 25 '22 02:10

Li Zheng