'Could not resolve dependency: peer cordova-plugin-file

i have tried to make an application with cordova, and found an error like this, i tried various ways still the error

this is the error:

npm resolution error report

2022-02-08T08:15:54.445Z

While resolving: [email protected] Found: [email protected] node_modules/cordova-plugin-file dev cordova-plugin-file@"4.3.3" from the root project

Could not resolve dependency: peer cordova-plugin-file@"^3.0.0" from [email protected] node_modules/cordova-plugin-file-transfer dev cordova-plugin-file-transfer@"1.5.1" 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": "cordova-plugin-file",
    "version": "4.3.3",
    "whileInstalling": {
      "name": "com.xxx.safeXXX",
      "version": "1.0.0",
      "path": "D:\\Alpha\\SWW-Debug\\app-debug1\\safeXXX"
    },
    "location": "node_modules/cordova-plugin-file",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "dev",
        "name": "cordova-plugin-file",
        "spec": "4.3.3",
        "from": {
          "location": "D:\\Alpha\\SWW-Debug\\app-debug1\\safeXXX"
        }
      }
    ]
  },
  "currentEdge": {
    "type": "dev",
    "name": "cordova-plugin-file",
    "spec": "4.3.3",
    "from": {
      "location": "D:\\Alpha\\SWW-Debug\\app-debug1\\safeXXX"
    }
  },
  "edge": {
    "type": "peer",
    "name": "cordova-plugin-file",
    "spec": "^3.0.0",
    "error": "INVALID",
    "from": {
      "name": "cordova-plugin-file-transfer",
      "version": "1.5.1",
      "whileInstalling": {
        "name": "com.xxx.safeXXX",
        "version": "1.0.0",
        "path": "D:\\Alpha\\SWW-Debug\\app-debug1\\safeXXX"
      },
      "location": "node_modules/cordova-plugin-file-transfer",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "dev",
          "name": "cordova-plugin-file-transfer",
          "spec": "1.5.1",
          "from": {
            "location": "D:\\Alpha\\SWW-Debug\\app-debug1\\safeXXX"
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false
}

my specifications:

  • gradle Version 7.3.3
  • cordova Version 11.0.0
  • npm version 8.4.1
  • java version "1.8.0_321"
  • Java(TM) SE Runtime Environment (build 1.8.0_321-b07)
  • Java HotSpot(TM) 64-Bit Server VM (build 25.321-b07, mixed mode)


Sources

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

Source: Stack Overflow

Solution Source