angular 4 compatibility

Bug description:

See how to reproduce below. The issue is that currently the generated package.json has:

"peerDependencies": {
  "@angular/common": "^2.0.0",
  "@angular/compiler": "^2.0.0",
  "@angular/core": "^2.0.0",
  "@angular/forms": "^2.0.0"
},

which is too restrictive – according to the official docs :

One piece of advice: peer dependency requirements, unlike those for regular dependencies, should be lenient

Note: this is a follow-up to #1390 which is indeed wrong – I didn’t know the package.json was autogenerated and changed the actual dependencies (because I was looking at using the fork directly as a dependency of my project), but the issue remains.

Note2: by using "^2.0.0 || >=4.0.0-beta <5.0.0", you would still be supporting 2.x.

How to reproduce the issue:

npm install -g @angular/cli
ng new ngcli-ng4 --ng4
cd ngcli-ng4
npm install --save ng-bootstrap

output

ngcli-ng4@0.0.0 /ything/projects/tmk/tmp/ngcli-ng4
├── UNMET PEER DEPENDENCY @angular/common@4.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/compiler@4.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/core@4.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/forms@4.0.0-rc.5
├─┬ ng-bootstrap@1.1.16-1
│ └── moment@2.15.1
└── UNMET PEER DEPENDENCY zone.js@0.7.8

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @angular/core@4.0.0-rc.5 requires a peer of zone.js@^0.8.4 but none was installed.
npm WARN ng-bootstrap@1.1.16-1 requires a peer of @angular/common@^2.0.0 but none was installed.
npm WARN ng-bootstrap@1.1.16-1 requires a peer of @angular/compiler@^2.0.0 but none was installed.
npm WARN ng-bootstrap@1.1.16-1 requires a peer of @angular/core@^2.0.0 but none was installed.
npm WARN ng-bootstrap@1.1.16-1 requires a peer of @angular/forms@^2.0.0 but none was installed.

Versions

  • npm 3.10.10
  • Angular: 4.0.0-rc.5
  • ng-bootstrap: 1.1.16

2 thoughts on “angular 4 compatibility

  1. OK, seems like all the issues on the Angular side are fixed in the 4.0.0 final, I got ng-bootstrap working perfectly fine with 2.3.1+ and 4.0.0 locally (both JIT and AOT). Cutting a release that will relax peer dependencies range right now.