1

The app used to work fine earlier with swift v3, Xcode v10.1 and react-native v54.4, but then I upgraded it to swift 5 and Xcode 10.2, and successfully converted all the swift codes from 3 to 5. I also updated react-native to 59.9 and other dependencies too, as per requirement. But now when I use command "npm run ibuild" in terminal, it shows that there is syntax error in ".js" files present inside "node_modules" folder.

I searched a lot on internet and based on that I created a .babelrc file, which to my understanding, is responsible for dealing with these javascript files present inside node_modules folder and create app bundle. I went to "https://babeljs.io/repl" to check if those javascript files run properly, but I was shown the same error there also. So does it mean that the problem is in javascript files in node_modules folder and not in .babelrc file?? Or am I making some other mistake?

Here is my package.json file so you can find all the versions here -

{
  "name": "abc",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest",
    "abuild": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output Android/app/src/main/assets/index.android.bundle --assets-dest Android/app/src/main/res",
    "alog": "react-native log-android",
    "ilog": "react-native log-ios",
    "ibuild": "react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ./ios/def/main.jsbundle --assets-dest ./ios",
    "abuildDev": "react-native run-android --variant DevDebug",
    "abuildDevRelease": "react-native run-android --variant DevRelease",
    "abuildQa": "react-native run-android --variant qaDebug",
    "abuildQaRelease": "react-native run-android --variant qaRelease",
    "abuildUATRelease": "react-native run-android --variant uatRelease"
  },
  "dependencies": {
    "create-react-app": "^1.5.2",
    "global": "^4.3.2",
    "lodash": "^4.17.10",
    "moment": "^2.23.0",
    "npm": "^6.5.0",
    "react": "16.3.0-alpha.1",
    "react-native": "^0.54.4",
    "react-native-checkbox": "^2.0.0",
    "react-native-datepicker": "^1.7.1",
    "react-native-image-picker": "^0.26.7",
    "react-native-radio-form": "^1.1.0",
    "react-native-scrollable-tab-view": "0.8.0",
    "react-native-select-input-ios": "^1.1.5",
    "react-native-simple-radio-button": "^2.7.2",
    "react-native-swipeable": "^0.6.0",
    "react-navigation": "^1.5.10",
    "yarn": "^1.13.0"
  },
  "devDependencies": {
    "babel-jest": "22.4.3",
    "babel-preset-react-native": "4.0.0",
    "jest": "22.4.3",
    "react-test-renderer": "^16.7.0"
  },
  "jest": {
    "preset": "react-native"
  },
  "rnpm": {
    "assets": [
      "./assets/fonts/"
    ]
  }
}

And this is my .babelrc file -

{
  "presets": ["@babel/preset-react"]
}

There are a few errors (all of them s=are syntax errors) and here is such an example -

error SyntaxError: /Users/aaa/Desktop/abc/node_modules/react-navigation/src/routers/StackRouter.js: Unexpected token, expected "," (140:15)

138 |

139 | paths = Object.entries(pathsByRouteNames);

140 | paths.sort((a: [string, *], b: [string, *]) => b[1].priority - a[1].priority);

 |                ^

141 |

142 | return {

143 | getComponentForState(state) {. Run CLI with --verbose flag for more details.

npm ERR! code ELIFECYCLE

npm ERR! errno 1

npm ERR! abc@0.0.1 ibuild: react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ./ios/def/main.jsbundle --assets-dest ./ios

npm ERR! Exit status 1

npm ERR!

npm ERR! Failed at the abc@0.0.1 ibuild script.

npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

npm ERR! /Users/aaa/.npm/_logs/2019-06-27T09_27_38_286Z-debug.log

Please help me out with it, I understand maybe I'm missing something very basic here. Do ask if you need anymore information about it.

robben
  • 637
  • 1
  • 7
  • 14
  • check your documentation again, for version 59.9 you no longer use `babelrc`, you use `babel.config.js`. – Daniel Aug 16 '19 at 00:59

0 Answers0