【问题标题】:react-currency-format is not installing, how to fix it?react-currency-format 未安装,如何解决?
【发布时间】:2021-02-20 13:13:36
【问题描述】:

我正在尝试在我的项目中使用 react-currency-format 库,但我无法安装该软件包。 我认为依赖项有问题,但我无法弄清楚什么与什么冲突。

# npm resolution error report

2021-02-20T09:51:09.030Z

While resolving: x-clone@0.1.0
Found: react@17.0.1
node_modules/react
  react@"^17.0.1" from the root project

Could not resolve dependency:
peer react@"^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0" from react-currency-format@1.0.0
node_modules/react-currency-format
  react-currency-format@"*" from the root project

Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Raw JSON explanation object:

{
  "code": "ERESOLVE",
  "current": {
    "name": "react",
    "version": "17.0.1",
    "whileInstalling": {
      "name": "x-clone",
      "version": "0.1.0",
      "path": "/Users/Hamed_Iam/Desktop/x-clone"
    },
    "location": "node_modules/react",
    "dependents": [
      {
        "type": "prod",
        "name": "react",
        "spec": "^17.0.1",
        "from": {
          "location": "/Users/Hamed_Iam/Desktop/x-clone"
        }
      }
    ]
  },
  "edge": {
    "type": "peer",
    "name": "react",
    "spec": "^0.14 || ^15.0.0-rc || ^15.0.0 || ^16.0.0-rc || ^16.0.0",
    "error": "INVALID",
    "from": {
      "name": "react-currency-format",
      "version": "1.0.0",
      "whileInstalling": {
        "name": "x-clone",
        "version": "0.1.0",
        "path": "/Users/Hamed_Iam/Desktop/x-clone"
      },
      "location": "node_modules/react-currency-format",
      "dependents": [
        {
          "type": "prod",
          "name": "react-currency-format",
          "spec": "*",
          "from": {
            "location": "/Users/Hamed_Iam/Desktop/x-clone"
          }
        }
      ]
    }
  },
  "peerConflict": null,
  "strictPeerDeps": false,
  "force": false
}

我也试过npm install react-currency-format --save,但没用。 我的 npm 版本是 7.5.3 和节点 v14.15.4,我不想使用 --force。有解决办法吗?

【问题讨论】:

标签: reactjs npm npm-install


【解决方案1】:

像这样使用--force:npm install react-currency-format --save --force

【讨论】:

    【解决方案2】:

    像这样使用它:npm install react-currency-format --save --force

    【讨论】:

      【解决方案3】:

      目前 React 已经提出了一个更新,所以最好同时使用 --force--save

      npm install react-currency-format --save --force
      

      【讨论】:

        【解决方案4】:

        您可以使用以下命令来安装它:

        npm install react-currency-format --save --force
        

        【讨论】:

          猜你喜欢
          • 2022-07-29
          • 1970-01-01
          • 1970-01-01
          • 2017-05-06
          • 1970-01-01
          • 2021-09-04
          • 2022-12-20
          • 1970-01-01
          • 2022-11-19
          相关资源
          最近更新 更多