1

Im new to react-native. I keep getting this error when I run

react-native run-android

This is my last package.json, that was working Ok the last time I pushed changes but now it seems to have broken.

my package.json

{
  "name": "taxiapp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@babel/runtime": "^7.0.0",
    "native-base": "^2.8.0",
    "react": "16.5.0",
    "react-addons-update": "^15.6.2",
    "react-native": "^0.54.1",
    "react-native-maps": "^0.21.0",
    "react-native-router-flux": "^4.0.5",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "23.6.0",
    "metro-react-native-babel-preset": "^0.48.1",
    "react-test-renderer": "16.5.0",
    "redux-logger": "^3.0.6"
  },
  "jest": {
    "preset": "react-native"
  }
}
Kiabit
  • 41
  • 1
  • 6

2 Answers2

1

Try to run:

del %appdata%\Temp\react-* & del %appdata%\Temp\metro-* & del %appdata%\Temp\haste-* & watchman watch-del-all & npm start -- --reset-cache

If it still doesn't work you could try 2 solutions here:

Upgrade react-native to 0.57.2

or downgrade babel, from what I know RN 0.54 uses babel 6 not 7.

Here is a configuration that worked for me for RN 0.57:

React native upgrade from babel 6 to babel 7

Florin Dobre
  • 9,872
  • 3
  • 59
  • 93
  • Thanks! now Im getting this new error: error: bundling failed: Error: Unable to resolve module `scheduler/tracing` from `C:\Users\Santiago\Google Drive\files\php\repos\taxiapp\node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js`: Module `scheduler/tracing` does not exist in the Haste module map – Kiabit Oct 18 '18 at 12:46
1

Please try adding these transform rules into your package.json:

"jest": {
  "preset": "react-native",
  "transform": {
    "^.+\\.js$": "<rootDir>/node_modules/react-native/jest/preprocessor.js"
  },
  "transformIgnorePatterns": [
    "node_modules/(?!(jest-)?react-native)"
  ]
},
Kevin van Zyl
  • 397
  • 4
  • 16