AnthonyNahas / ngx-long-press2

Angular Library to handle long mouse clicks event for desktop and long touch events for mobile and tablets
https://anthonynahas.github.io/ngx-long-press2/
MIT License
5 stars 3 forks source link

Could not resolve dependency #2

Closed sultanmyrza closed 2 years ago

sultanmyrza commented 2 years ago

Is it my environment or need to update ngx-long-press2 project desp?

# npm resolution error report

2022-01-28T08:07:31.362Z

While resolving: my-awesome-project@0.47.0
Found: @angular/common@12.2.16
node_modules/@angular/common
  @angular/common@"^12.2.4" from the root project

Could not resolve dependency:
peer @angular/common@"^10.0.14" from ngx-long-press2@2.0.0
node_modules/ngx-long-press2
  ngx-long-press2@"^2.0.0" 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": "@angular/common",
    "version": "12.2.16",
    "whileInstalling": {
      "name": "my-awesome-project",
      "version": "0.47.0",
      "path": "/Users/sultanmyrza/Clients/project/my-awesome-project"
    },
    "location": "node_modules/@angular/common",
    "isWorkspace": false,
    "dependents": [
      {
        "type": "prod",
        "name": "@angular/common",
        "spec": "^12.2.4",
        "from": {
          "location": "/Users/sultanmyrza/Clients/project/my-awesome-project"
        }
      }
    ]
  },
  "currentEdge": {
    "type": "prod",
    "name": "@angular/common",
    "spec": "^12.2.4",
    "from": {
      "location": "/Users/sultanmyrza/Clients/project/my-awesome-project"
    }
  },
  "edge": {
    "type": "peer",
    "name": "@angular/common",
    "spec": "^10.0.14",
    "error": "INVALID",
    "from": {
      "name": "ngx-long-press2",
      "version": "2.0.0",
      "whileInstalling": {
        "name": "my-awesome-project",
        "version": "0.47.0",
        "path": "/Users/sultanmyrza/Clients/project/my-awesome-project"
      },
      "location": "node_modules/ngx-long-press2",
      "isWorkspace": false,
      "dependents": [
        {
          "type": "prod",
          "name": "ngx-long-press2",
          "spec": "^2.0.0",
          "from": {
            "location": "/Users/sultanmyrza/Clients/project/my-awesome-project"
          }
        }
      ]
    }
  },
  "strictPeerDeps": false,
  "force": false
}
AnthonyNahas commented 2 years ago

please try npm i --force

sultanmyrza commented 2 years ago

Hello @AnthonyNahas

Around February I just did npm install ngx-long-press2 --legacy-peer-deps and things worked fine. But recently out of nowhere my Github actions started to fail.

Github failed action logs (click to expand) ``` Run npm install npm install shell: /usr/bin/bash -e {0} npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: ngx-long-press2@2.0.0 npm ERR! Found: @angular/common@12.2.4 npm ERR! node_modules/@angular/common npm ERR! @angular/common@"^12.2.4" from the root project npm ERR! peer @angular/common@"^12.0.0 || ^13.0.0-0" from @angular/cdk@12.2.4 npm ERR! node_modules/@angular/cdk npm ERR! @angular/cdk@"^12.2.4" from the root project npm ERR! peer @angular/cdk@"12.2.4" from @angular/material@12.2.4 npm ERR! node_modules/@angular/material npm ERR! @angular/material@"^12.2.4" from the root project npm ERR! 1 more (@ngx-formly/material) npm ERR! 8 more (@angular/forms, @angular/material, ...) npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@"^10.0.14" from ngx-long-press2@2.0.0 npm ERR! node_modules/ngx-long-press2 npm ERR! ngx-long-press2@"^2.0.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: @angular/common@10.2.5 npm ERR! node_modules/@angular/common npm ERR! peer @angular/common@"^10.0.14" from ngx-long-press2@2.0.0 npm ERR! node_modules/ngx-long-press2 npm ERR! ngx-long-press2@"^2.0.0" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /home/runner/.npm/eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2022-06-09T10_32_40_215Z-debug-0.log Error: Process completed with exit code 1. ```
My package.json file (click to expand) ``` "dependencies": { "@angular/animations": "^12.2.4", "@angular/cdk": "^12.2.4", "@angular/common": "^12.2.4", "@angular/core": "^12.2.4", "@angular/forms": "^12.2.4", "@angular/material": "^12.2.4", "@angular/platform-browser": "^12.2.4", "@angular/platform-browser-dynamic": "^12.2.4", "@angular/router": "^12.2.4", "@capacitor-community/bluetooth-le": "^1.7.0", "@capacitor-community/http": "github:numbersprotocol/http#fix-catch-disabled-Local-Network-case-on-iOS", "@capacitor-community/wifi": "github:numbersprotocol/community-capacitor-wifi#capacitor3", "@capacitor/android": "https://gitpkg.now.sh/numbersprotocol/capacitor/android?release-3.4.1-range-request-fix", "@capacitor/app": "^1.1.0", "@capacitor/browser": "^1.0.7", "@capacitor/camera": "^1.3.0", "@capacitor/clipboard": "^1.0.7", "@capacitor/core": "^3.4.1", "@capacitor/device": "^1.1.2", "@capacitor/filesystem": "^1.1.0", "@capacitor/geolocation": "^1.3.1", "@capacitor/ios": "^3.4.1", "@capacitor/local-notifications": "^1.1.0", "@capacitor/network": "^1.0.7", "@capacitor/push-notifications": "^1.0.9", "@capacitor/share": "^1.1.1", "@capacitor/splash-screen": "^1.2.2", "@capacitor/storage": "^1.2.4", "@ionic/angular": "^5.6.11", "@ionic/core": "^5.6.11", "@ionic/pwa-elements": "^3.0.2", "@ngneat/transloco": "^2.22.0", "@ngneat/until-destroy": "^8.1.0", "@ngrx/component": "^12.4.0", "@ngrx/store": "^12.4.0", "@ngx-formly/core": "^5.10.22", "@ngx-formly/material": "^5.10.22", "@ngx-formly/schematics": "^5.10.22", "@numbersprotocol/preview-camera": "github:numbersprotocol/preview-camera#release-0.0.2-auto-rotate-fix", "@numbersprotocol/preview-video": "github:numbersprotocol/preview-video", "async-mutex": "^0.3.2", "buffer": "^5.7.1", "capacitor-blob-writer": "^1.0.4", "compressorjs": "^1.0.7", "immutable": "^4.0.0-rc.14", "lodash-es": "^4.17.21", "material-design-icons-iconfont": "^6.1.0", "ng-circle-progress": "^1.6.0", "ngx-joyride": "^2.5.0", "ngx-long-press2": "^2.0.0", "ngx-pinch-zoom": "^2.6.0", "process": "^0.11.10", "rxjs": "^6.6.7", "stream-browserify": "^2.0.2", "swiper": "^6.8.4", "tslib": "^2.3.1", "web3": "^1.5.2", "zone.js": "^0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "^12.2.4", "@angular-eslint/builder": "^12.3.1", "@angular-eslint/eslint-plugin": "^12.3.1", "@angular-eslint/eslint-plugin-template": "^12.3.1", "@angular-eslint/schematics": "^12.3.1", "@angular-eslint/template-parser": "^12.3.1", "@angular/cli": "^12.2.4", "@angular/compiler": "^12.2.4", "@angular/compiler-cli": "^12.2.4", "@angular/language-service": "^12.2.4", "@capacitor/cli": "^3.4.1", "@ionic/angular-toolkit": "^4.0.0", "@types/jasmine": "^3.8.2", "@types/jasminewd2": "^2.0.10", "@types/lodash-es": "^4.17.4", "@types/node": "^16.7.10", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "assert": "^2.0.0", "crypto-browserify": "^3.12.0", "eslint": "^7.32.0", "eslint-plugin-import": "^2.24.2", "eslint-plugin-prefer-arrow": "^1.2.3", "eslint-plugin-rxjs": "^3.3.7", "https-browserify": "^1.0.0", "husky": "^7.0.2", "jasmine-core": "^3.9.0", "jasmine-spec-reporter": "^7.0.0", "karma": "^6.3.4", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "^2.0.3", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.6.0", "lint-staged": "^11.1.2", "os-browserify": "^0.3.0", "prettier": "^2.3.2", "protractor": "~7.0.0", "stream-http": "^3.2.0", "stylelint": "^13.13.1", "stylelint-config-standard": "^22.0.0", "stylelint-scss": "^3.20.1", "ts-node": "^10.2.1", "typescript": "^4.3.5" }, ```

I'm not sure but is it because of ngx-long-press2's peerDependencies?

P.S: also in GitHub actions were configured by senior dev so I can not change npm install to npm install --force or --legacy-peer-deps so I think the next thing I will try to do is to clean up my dependencies versions.

sultanmyrza commented 2 years ago

Hello @AnthonyNahas, I created a fresh ionic project which uses angular 14 and npm install ngx-long-press2 causing this error

Error logs (click to expand) ``` npm i ngx-long-press2 npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: demo-angular@0.0.1 npm ERR! Found: @angular/common@14.0.2 npm ERR! node_modules/@angular/common npm ERR! @angular/common@"^14.0.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@"^10.0.14" from ngx-long-press2@2.0.0 npm ERR! node_modules/ngx-long-press2 npm ERR! ngx-long-press2@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See /Users/sultanmyrza/.npm/eresolve-report.txt for a full report. npm ERR! A complete log of this run can be found in: npm ERR! /Users/sultanmyrza/.npm/_logs/2022-06-21T06_46_03_071Z-debug-0.log ```

So if I want to be able to install ngx-long-press2 without --force or --legacy-peer-deps flags what should I do? Should I update peerDependencies of ngx-long-press2 from

 "peerDependencies": {
    "@angular/common": "^10.0.14",
    "@angular/core": "^10.0.14"
  }

to

 "peerDependencies": {
    "@angular/common": "^14.0.0",
    "@angular/core": "^14.0.0"
  }
AnthonyNahas commented 2 years ago

I will update the peer deps asap