'react-currency-format is not installing, how to fix it?

I am trying to use react-currency-format library in my project, but I cannot install the package. I think there is something wrong with dependencies but I couldnt figure out what is conflicting with what.

# npm resolution error report

2021-02-20T09:51:09.030Z

While resolving: [email protected]
Found: [email protected]
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 [email protected]
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
}

I also tried npm install react-currency-format --save but it didnt work. my npm version is 7.5.3 and node v14.15.4, I dont want to use --force. is there a fix for it?



Solution 1:[1]

use --force like this: npm install react-currency-format --save --force

Solution 2:[2]

use it like this: npm install react-currency-format --save --force

Solution 3:[3]

Currently React has come up with an Update so its better to use --force and --save together.

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

Solution 4:[4]

You can use the following command to install it :

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 azedine batouche
Solution 2 lucky shukla
Solution 3 273K
Solution 4 neeraj tk