如何在 react-native cli 中升级 core-js@3?

如何在 react-native cli 中升级 core-js@3?

问题描述:

我正在尝试使用 react-native cli 创建新项目,但是当我创建新项目时,我收到以下错误消息:

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 > core-js@1.2.7:core-js@

react-native > create-react-class > fbjs > core-js@1.2.7: 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.

下面列出的是我的 package.json 文件的内容:

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?

任何帮助将不胜感激!

下载并保存警告消息中请求的 core-js 模块的版本:

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

npm install --save core-js@^3

这将更新您的 react-native 项目的 core-js 依赖项以使用仍在积极使用的版本 ^3.xx保持.

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

希望有帮助!