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

Viewed 3156

After expo update, my project not working

The error is:

Failed building JavaScript bundle.
node_modules\react-native-gesture-handler\src\index.ts: [BABEL] D:\data\Anonymous\ReactNative\test\node_modules\react-native-gesture-handler\src\index.ts: You gave us a visitor for the node type TSInstantiationExpression but it's not a valid type

The dependencies of the project are:

packages: {
    "@react-navigation/bottom-tabs": "^6.3.1",
    "@react-navigation/drawer": "^6.4.1",
    "@react-navigation/native": "^6.0.10",
    "@react-navigation/stack": "^6.2.1",
    "expo": "~45.0.0",
    "expo-barcode-scanner": "~11.3.0",
    "expo-status-bar": "~1.3.0",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "https://github.com/expo/react-native/archive/sdk-45.0.0.tar.gz",
    "react-native-gesture-handler": "~2.2.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-paper": "^4.12.1",
    "react-native-reanimated": "~2.8.0",
    "react-native-safe-area-context": "4.2.4",
    "react-native-screens": "~3.11.1",
    "react-native-vector-icons": "^9.1.0",
    "react-native-web": "0.17.7",
}
6 Answers

I´ve encountered the same error, fixed it by upgrading my expo-cli with yarn global add expo-cli.

After couple of days struggling found what caused the issue. Everything started with the release of babel-core: 7.18.0. The problem in my case was different versions of babel in my project and expo. Fixed it by upgrading expo's version in %APPDATA%\Roaming\npm\node_modules\expo-cli\package.json. You should delete node_modules in this folder and run npm install. I would say your issue is similar but with different package

Its either an issue with the new v7.18.0 babel core release or a conflict with expo if you are using an older version. In my project we're using "expo": "41" and as a result, I needed to locked babel core to version "@babel/core": "7.17.12".

pnpm add -g expo-cli resolved the issue for me.

Delete node_modules and package-lock.json on your project directory and run the following commands npm install and expo start -c

rm -rf ./node_modules && rm yarn.lock && yarn (for yarn)

OR

rm -rf ./node_modules && npm i (for npm)

Related