facebook / metro

🚇 The JavaScript bundler for React Native
https://metrobundler.dev
MIT License
5.22k stars 626 forks source link

cannot find module babel-preset-react-native #431

Open mrishan1993 opened 5 years ago

mrishan1993 commented 5 years ago

I upgraded RN to 0.59 and installed metro-react-native-babel-preset latest version. While running react-native run-android, I get the error "Cannot find module babel-preset-react-native". I also changed the config file .babelrc

Package.json

  "name": "ReactNativeBoilerplate",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "@ant-design/react-native": "^3.1.5",
    "ajv": "^5.5.2",
    "axios": "^0.18.0",
    "feather-icons-react": "^0.3.1",
    "moment": "^2.24.0",
    "react": "^16.2.0",
    "react-native": "^0.59.0",
    "react-native-carousel-view": "^0.5.1",
    "react-native-fbsdk": "^0.8.0",
    "react-native-fontawesome": "^6.0.1",
    "react-native-icons": "^0.7.1",
    "react-native-image-zoom-viewer": "^2.2.25",
    "react-native-loader": "^1.2.1",
    "react-native-parallax-swiper": "^1.1.7",
    "react-native-share": "^1.2.1",
    "react-native-tab-view": "github:react-navigation/react-native-tab-view",
    "react-native-vector-icons": "^6.4.2",
    "react-navigation": "^1.5.1",
    "react-redux": "^5.0.7",
    "redux": "^3.7.2",
    "redux-thunk": "^2.2.0",
    "rn-fetch-blob": "^0.10.15"
  },
  "devDependencies": {
    "babel-eslint": "^8.2.2",
    "babel-jest": "^22.4.1",
    "eslint": "^4.18.2",
    "eslint-config-airbnb": "^16.1.0",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-plugin-import": "^2.9.0",
    "eslint-plugin-jsx-a11y": "^6.0.3",
    "eslint-plugin-react": "^7.7.0",
    "jest": "^22.4.2",
    "metro-react-native-babel-preset": "^0.54.1",
    "react-test-renderer": "^16.2.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

.babelrc { "presets": ["module:metro-react-native-babel-preset"] }

WhatsApp Image 2019-07-03 at 3 24 38 PM

Shanie1331 commented 5 years ago

+1

syJSdev commented 5 years ago

+1

fabiancarlos commented 4 years ago

remove .babelrc, create the file babel.config with the code below, then npm install on root, then remove the build folder on ios/, and try build again.

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
};
Krishnakumarskr commented 3 years ago

remove .babelrc, create the file babel.config with the code below, then npm install on root, then remove the build folder on ios/, and try build again.

module.exports = {
  presets: ['module:metro-react-native-babel-preset'],
};

After doing this I am getting the following error

error: index.js: [BABEL] D:\project\index.js: Cannot find module '@babel/helper-builder-binary-assignment-operator-visitor'