Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Babel Unknown option: .caller

When I run npm start babel is throwing the following error: ReferenceError: Unknown option: .caller. Check out http://babeljs.io/docs/usage/options/ for more information about options.

My package.json:

{
"private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "moment": "^2.20.1",
    "prop-types": "latest",
    "react": "^16.5",
    "react-native": "^0.57",
    "react-native-material-textfield": "^0.12.0",
    "react-native-material-ui": "^1.30.1",
    "react-native-off-canvas-menu": "^0.1.32",
    "react-native-pull-refresh": "^1.0.0",
    "react-native-size-matters": "^0.1.4",
    "react-native-snackbar": "^0.5.3",
    "react-native-snap-carousel": "^3.7.5",
    "react-native-vector-icons": "^6.0.2",
    "react-navigation": "^2.18.0",
    "react-redux": "^5.0.6",
    "redux": "^4.0.1",
    "redux-persist": "^5.5.0",
    "redux-thunk": "^2.2.0",
    "ree-validate": "^3.0.2"
  },
  "devDependencies": {
    "@babel/core": "7.0.0-beta.42",
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "^0.48.1",
    "react-test-renderer": "16.5.2"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./src/assets/fonts"
    ]
  }
}

I mention that my project is a react native application. I have no peer dependencies errors. I failed to find any conflicts between the different babel dependencies. Thank you for your help.

like image 863
Alphonse Avatar asked Oct 23 '18 11:10

Alphonse


1 Answers

According to RN 0.57 change log you need to:

Ensure that you have all the babel dependencies to version ^7.0.0 (you may also need to add babel-core": "7.0.0-bridge.0" as a yarn resolution to ensure retro-compatibility)

It seems that you have a @babel/core": "7.0.0-beta.42 not ^7.0.0.

Here is a configuration that worked for me in RN 0.57.1 and 0.57.2: https://stackoverflow.com/a/52717426/1979861

Also check the .babelrc file to be according to RN change.log.

At any point if you get some babel error you can try to clean all cache with something like this (using yarn or npm, depending on what you have):

rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && rm -rf node_modules && yarn install && npm start -- --reset-cache 
like image 116
Florin Dobre Avatar answered Sep 17 '22 23:09

Florin Dobre