微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

react-currency-format 未安装,如何修复?

如何解决react-currency-format 未安装,如何修复?

我试图在我的项目中使用 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","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","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。有解决办法吗?

解决方法

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

,

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。