ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.51k stars 576 forks source link

Warning when using ngx-translate v6.0.0-beta.1 with Ionic v2.0.0 #421

Closed fiznool closed 7 years ago

fiznool commented 7 years ago

When installing the newest ngx-translate beta into an Ionic 2 environment, the following npm warning is issued:

warning "@ngx-translate/core@6.0.0-beta.1" has incorrect peer dependency "@angular/core@^2.3.0".

The same thing happens when installing the new http-loader:

warning "@ngx-translate/http-loader@0.0.2" has incorrect peer dependency "@angular/core@>=2.3.0 || >=4.0.0-beta.0".

This is because Ionic 2 apps use Angular 2.2.1.

Is there a specific need to have a peerDependency of Angular 2.3.0+ or could it be relaxed to 2.2.1 for better compatibility with Ionic 2?

ocombe commented 7 years ago

I did that because of this note in angular/angular 2.3.1:

Due to regression in the 2.3.0 release that was fixed by https://github.com/angular/angular/pull/13464, components that have been compiled using 2.3.0 and published to npm will need to be recompiled and republished.

The >=2.3.1 compiler will issue is the following error if it encounters components compiled with 2.3.0: Unsupported metadata version 2 for module ${module}. This module should be compiled with a newer version of ngc.

We are adding more tests to our test suite to catch these kinds of problems before we cut a release.

But after reading the note again, and asking confirmation to the angular team, it just means that you shouldn't use 2.3.0 to compile. Since it has been fixed in 2.3.1 you can compile your lib again and it should work with all versions. I'll change the peer dependency back to 2.x / 4.x. Thanks for opening the ticket :)

I'll publish a new beta later today.

Richie765 commented 7 years ago

Could you do the same for http-loader? I've now installed @0.0.1 and it seems to work fine, but I'm not sure if that is ideal.

fiznool commented 7 years ago

See https://github.com/ngx-translate/http-loader/pull/1

ocombe commented 7 years ago

It should be fixed, thanks @fiznool !

miniplus commented 7 years ago

@ocombe

The project I'm currently working on is on Angular 2.0.1. I'm getting the following error: Uncaught TypeError: ctorParameters.map is not a function

Apparently this has to do with the Angular compiler (http://stackoverflow.com/a/41444599). The solution seems to be to upgrade to at least 2.3.1 because of changes.

If this is truly the case than this has to be reversed I guess? The other possibility is to up the minimum dependency to 2.2.3 as you mentioned here

Cross referencing #386

fiznool commented 7 years ago

Could you share your package.json?

Another answer to that question suggests that all additional angular dependencies should also be pinned to the same version, I'm wondering if that could be the issue?

http://stackoverflow.com/a/41775814

miniplus commented 7 years ago
  "dependencies": {
    "@angular/common": "2.0.1",
    "@angular/compiler": "2.0.1",
    "@angular/core": "2.0.1",
    "@angular/forms": "2.0.1",
    "@angular/http": "2.0.1",
    "@angular/platform-browser": "2.0.1",
    "@angular/platform-browser-dynamic": "2.0.1",
    "@angular/router": "3.0.1",
    "@ngx-translate/core": "^6.0.0",
    "@ngx-translate/http-loader": "0.0.3",
    "X-editable": "github:vitalets/x-editable",
    "bootstrap": "^3.3.7",
    "bootstrap-colorpicker": "^2.3.5",
    "bootstrap-duallistbox": "github:istvan-ujjmeszaros/bootstrap-duallistbox",
    "bootstrap-markdown": "^2.10.0",
    "bootstrap-progressbar": "^0.9.0",
    "bootstrap-slider": "^9.1.3",
    "bootstrap-tagsinput": "^0.7.1",
    "bootstrap-timepicker": "^0.5.2",
    "chart.js": "2.3.0",
    "ckeditor": "^4.5.10",
    "clockpicker": "0.0.7",
    "clone": "^1.0.2",
    "core-js": "^2.4.1",
    "debounce": "^1.0.0",
    "dropzone": "^4.3.0",
    "dygraphs": "^1.1.1",
    "fuelux": "^3.15.8",
    "he": "^1.1.0",
    "highcharts": "^4.2.7",
    "ion-rangeslider": "^2.1.4",
    "jquery": "^2.2.4",
    "jquery-color": "jquery/jquery-color#2.1.2",
    "jquery-jcrop": "^0.9.13",
    "jquery-knob": "^1.2.11",
    "jquery-ui-npm": "^1.12.0",
    "jquery-validation": "^1.15.1",
    "jquery.maskedinput": "^1.4.1",
    "jvectormap": "^2.0.4",
    "markdown": "^0.5.0",
    "morris.js": "^0.5.0",
    "ng2-bootstrap": "1.1.7",
    "ng2-popover": "git+https://github.com/griga/ng2-popover.git",
    "ng2-redux": "^4.0.0-beta.0",
    "nouislider": "^8.5.1",
    "primeng": "^1.0.1",
    "raphael": "^2.2.1",
    "redux": "^3.6.0",
    "rxjs": "5.0.0-beta.12",
    "scriptjs": "^2.5.8",
    "select2": "^4.0.3",
    "smartadmin-plugins": "^1.0.13",
    "summernote": "^0.8.1",
    "to-markdown": "^3.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@types/jasmine": "2.5.41",
    "angular-cli": "1.0.0-beta.15",
    "angular2-template-loader": "^0.6.0",
    "codelyzer": "~0.0.26",
    "expose-loader": "^0.7.1",
    "imports-loader": "^0.6.5",
    "jasmine-core": "2.5.1",
    "jasmine-spec-reporter": "2.7.0",
    "karma": "1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "4.0.9",
    "script-loader": "^0.7.0",
    "ts-node": "1.2.1",
    "tslint": "3.13.0",
    "typescript": "2.0.2"
  }

No peer deps.

fiznool commented 7 years ago

That's a lot of dependencies!

You could safely update all your angular dependencies to 2.3.1 or higher and everything would start to work I think?