0

I have an Angular 2 application and I am trying to use angular2-perfect-scrollbar.

But I am getting peer dependencies error. I googled and tried to downgrade rxjs but still doesnot works.

enter image description here

My package.json file looks like:

  "license": "",
  "dependencies": {
    "@angular/common": "~2.1.2",
    "@angular/compiler": "~2.1.2",
    "@angular/core": "~2.1.2",
    "@angular/forms": "~2.1.2",
    "@angular/http": "~2.1.2",
    "@angular/platform-browser": "~2.1.2",
    "@angular/platform-browser-dynamic": "~2.1.2",
    "@angular/router": "~3.1.2",
    "@ngstarter/systemjs-extension": "1.0.0-rc.4",
    "@types/core-js": "^0.9.34",
    "@types/jasmine": "^2.5.36",
    "@types/lodash": "^4.14.37",
    "@types/selenium-webdriver": "^2.44.28",
    "bootstrap": "^3.3.7",
    "chart.js": "^2.4.0",
    "codelyzer": "1.0.0-beta.3",
    "core-js": "^2.4.1",
    "del": "~2.2.2",
    "font-awesome": "^4.7.0",
    "glob": "^7.0.6",
    "gulp": "^3.9.1",
    "gulp-cssnano": "^2.1.2",
    "gulp-if": "~2.0.1",
    "gulp-less": "^3.3.0",
    "gulp-protractor": "^3.0.0",
    "gulp-rev": "^7.1.2",
    "gulp-rev-replace": "^0.4.3",
    "gulp-sourcemaps": "^2.2.0",
    "gulp-template": "^4.0.0",
    "gulp-tslint": "6.1.2",
    "gulp-typescript": "~3.1.2",
    "gulp-uglify": "~2.0.0",
    "gulp-useref": "~3.1.2",
    "jasmine-core": "~2.5.0",
    "jquery": "^3.1.0",
    "karma": "~1.3.0",
    "karma-coverage": "~1.1.1",
    "karma-ie-launcher": "^1.0.0",
    "karma-jasmine": "~1.0.2",
    "karma-sourcemap-loader": "^0.3.7",
    "lodash": "^4.15.0",
    "ng2-charts": "^1.4.4",
    "remap-istanbul": "~0.6.4",
    "require-dir": "~0.3.0",
    "run-sequence": "~1.2.2",
    "rxjs": "5.0.0-beta.12",
    "systemjs": "^0.19.40",
    "tslint": "~3.15.1",
    "typescript": "^2.0.10",
    "underscore": "^1.8.3",
    "yargs": "^6.3.0",
    "zone.js": "^0.6.26"
  },
  "devDependencies": {
    "browser-sync": "^2.17.5",
    "connect-history-api-fallback": "^1.2.0",
    "gulp-util": "^3.0.7",
    "gulp-war": "^0.1.4",
    "gulp-zip": "^3.2.0",
    "ts-node": "^1.6.1"
  }
}
Manish Gautam
  • 516
  • 2
  • 7
  • 19

1 Answers1

1

Looking at article 9 of the semantic versioning specification:

Pre-release versions have a lower precedence than the associated normal version.

My understanding here is that the version of a prerelease version is always higher than any previous major version, but always lower than any non-prerelease versions at the same major version.

For example, given rxjs: v4.x.x < v5.0.0-beta.12 < v5.0.0

And that's where your problem lies: the versions of @angular that you're using expect a version of rxjs that's incompatible with the version expected by angular2-perfect-scrollbar.

There are two solutions to this:

  • Ignore the peer dependency error, and use the v5.0.0 release. This is probably not a good idea, however you may have other limitations that make it worthwhile for now. Peer dependencies are designed so that you can provide your own version of a library (rather than being restricted to the version used by another library), so I don't think it's too problematic. Just make sure that you test that what you're using from each library is stable for the version of rxjs.
  • Probably a better solution: update the version of @angular that you're using.
Micheal Hill
  • 1,619
  • 2
  • 17
  • 38