@react-navigation/stack/src/index.tsx: Unexpected token on iOS simulator

I have been encountering with the issue which is related to @react-navigation/stack/. I tried many solutions on the internet but it didn’t work. Please see the details below

System information

 Expo CLI 4.0.7 environment info:
    System:
      OS: macOS 11.0.1
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.15.1 - ~/.nvm/versions/node/v14.15.1/bin/node
      Yarn: 1.22.10 - /usr/local/bin/yarn
      npm: 6.14.8 - ~/.nvm/versions/node/v14.15.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.10.1 - /Users/nslog0/.rbenv/shims/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    IDEs:
      Xcode: 12.3/12C33 - /usr/bin/xcodebuild
    npmPackages:
      expo: ~40.0.0 => 40.0.1
      react: 16.13.1 => 16.13.1
      react-dom: 16.13.1 => 16.13.1
      react-native: https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz => 0.63.2
      react-native-web: ~0.13.12 => 0.13.18
    Expo Workflow: managed

Error

package.json

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "test": "jest --watchAll"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/vector-icons": "^12.0.0",
    "@react-native-community/masked-view": "0.1.10",
    "@react-navigation/bottom-tabs": "5.11.2",
    "@react-navigation/native": "~5.8.10",
    "@react-navigation/stack": "^5.14.2",
    "expo": "~40.0.0",
    "expo-asset": "~8.2.1",
    "expo-constants": "~9.3.0",
    "expo-font": "~8.4.0",
    "expo-linking": "~2.0.0",
    "expo-splash-screen": "~0.8.0",
    "expo-status-bar": "~1.0.3",
    "expo-web-browser": "~8.6.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-40.0.1.tar.gz",
    "react-native-gesture-handler": "~1.8.0",
    "react-native-safe-area-context": "3.1.9",
    "react-native-screens": "~2.15.0",
    "react-native-web": "~0.13.12"
  },
  "devDependencies": {
    "@babel/core": "^7.12.13",
    "@types/react": "~16.9.35",
    "@types/react-native": "~0.63.2",
    "jest-expo": "~40.0.0",
    "typescript": "~4.0.0"
  },
  "private": true
}

please help me

Hey @nslog0, this seems to be a react-nav specific issue rather than an Expo one. One quick recommendation is to check and make sure you don’t have any conflicting Typescript versions in your environment, both locally and globally.

Cheers,
Adam

1 Like

Thank you for your answer.

I tried to solve the problem follow by this link Issues · react-navigation/react-navigation · GitHub didn’t help.

and what I don’t understand is only my laptop cannot run but for my friend it works, they don’t get any error. What I am thinking is like your recommendation for TS version. I did try to remove all TS in my laptop and install the latest version of it, so didn’t work for me. I have no idea where expo use my TS

I’m just wondering if anyone has a problem like me.