Reputation: 36688
Following the Angular update guide (https://update.angular.io/) I started with
$ ng update @angular/cli @angular/core
But that yielded this list of some incompatibilities:
Package "codelyzer" has an incompatible peer dependency to "@angular/core" (requires ">=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0" (extended), would install "8.1.0").
Package "@ngrx/router-store" has an incompatible peer dependency to "@angular/router" (requires "^6.0.0" (extended), would install "8.1.0").
Package "ngrx-tslint-oftype" has an incompatible peer dependency to "typescript" (requires "^2.8.3", would install "3.4.5").
Package "@angular/http" has an incompatible peer dependency to "@angular/platform-browser" (requires "6.1.3" (extended), would install "8.1.0").
Package "@angular/material" has an incompatible peer dependency to "@angular/core" (requires ">=6.0.0-beta.0 <7.0.0" (extended), would install "8.1.0").
Package "codelyzer" has an incompatible peer dependency to "@angular/compiler" (requires ">=2.3.1 <7.0.0 || >6.0.0-beta <7.0.0" (extended), would install "8.1.0").
Package "@angular/material" has an incompatible peer dependency to "@angular/core" (requires ">=6.0.0-beta.0 <7.0.0" (extended), would install "8.1.0").
I updated codelyzer
to knock that off the list.
I then figured that I could change the command to remove a few more:
$ ng update @angular/cli @angular/core @ngrx/store @angular/material @angular/http
That left me with this puzzling result, puzzling because one of the two @angular/http
incompatibilities is still present!
Package "ngrx-tslint-oftype" has an incompatible peer dependency to "typescript" (requires "^2.8.3", would install "3.4.5").
Package "@angular/http" has an incompatible peer dependency to "@angular/core" (requires "7.2.15", would install "8.1.0")
So I have two issues:
npm shrinkwrap
--seemed to have issues.Note that I also tried ng update --all
but that gave me some incompatibilities with other packages, not relevant to the Angular upgrade.
I am hesitant to add a --force
; would much prefer to be able to fix things so that is not a necessity. Suggestions?
Upvotes: 1
Views: 1791
Reputation: 8650
@angular/http
has been deprecated by Angular and is no longer in use (See here). You can make use of @angular/common/http
instead (See docs). You will need to use the HttpClient
class from the HttpClientModule
app.module.ts
import { HttpClientModule } from '@angular/common/http';
@NgModule({
imports: [
BrowserModule,
HttpClientModule
],
...
Wherever you want to use it
import { HttpClient } from '@angular/common/http';
class MyService() {
constructor(http: HttpClient) { }
...
As for the issue with ngrx-tslint-oftype
. Try upgrading your typescript version to 3.
Upvotes: 2