How to upgrade core-js@3 in react-native cli?

M.D Luffy picture M.D Luffy · Jun 3, 2019 · Viewed 9.1k times · Source

I am trying to create new project with react-native cli, but when I create a new project I am receiving the following error message:

react-native > create-react-class > fbjs > [email protected]: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.

Listed below is the contents of my package.json file:

{
      "name": "EmojiDictRN",
      "version": "0.0.1",
      "private": true,
      "scripts": {
        "start": "node node_modules/react-native/local-cli/cli.js start",
        "test": "jest"
      },
      "dependencies": {
        "react": "16.8.3",
        "react-native": "0.59.8"
      },
      "devDependencies": {
        "@babel/core": "^7.4.5",
        "@babel/runtime": "^7.4.5",
        "babel-jest": "^24.8.0",
        "jest": "^24.8.0",
        "metro-react-native-babel-preset": "^0.54.1",
        "react-test-renderer": "16.8.3"
      },
      "jest": {
        "preset": "react-native"
      }
    }

To see the full output from my terminal please click here. Any ideas on how to resolve this warning message?

Any help would be greatly appreciated!

Answer

Nathan picture Nathan · Jun 3, 2019

Download and save the version of the core-js module which is requested within your warning message:

npm install --save core-js@^3

This will update the core-js dependency for your react-native project to use version ^3.x.x which is still being actively maintained.

Hopefully that helps!