Enterprise Framework

Software Solutions in the Enterprise

Angular 5 to 6 Upgrade Migration with Error Fixes

Angular 5 to 6 Upgrade Migration

  • Go to https://update.angular.io/ to generate steps for upgrade.
  • Switch HtpModule and Http to HttpClientModule and HttpClient
  • Make sure you're using Node 8 or later
  • Run the commands
    • ng install -g @angular/cli
    • ng install @angular/cli
    • ng update @angular/cli
    • ng update @angular/cli (Yes this was intended.  Run it twice, I think there is a bug with update).  This will cause angular-cli.json to be updated (Renamed) to angular.json and keep you from getting the error:  Local workspace file ('angular.json') could not be found.
  • ng update @angular/core
  • ng update @angular/material
  • ng update
  • ng update
  • rxjs-5-to-6-migrate -p src/tsconfig.app.json
  • Remove deprecated RxJS 6 features using rxjs-tslint auto update rules.  If you don't you'll get errors like node_modules/rxjs/BehaviorSubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.
    • npm install -g rxjs-tslint
    • npm install --save rxjs-tslint
  • Add rules to tslin.json
    • {
        "rulesDirectory": [
        "rules": {
          "rxjs-collapse-imports": true,
          "rxjs-pipeable-operators-only": true,
          "rxjs-no-static-observable-methods": true,
          "rxjs-proper-imports": true
    • Lint the project by executing
      • ./node_modules/.bin/tslint -c tslint.json -p tsconfig.json
      • If you get the error Error: Cannot find module 'typescript', run npm install -g typescript then re-run 
        • ./node_modules/.bin/tslint -c tslint.json -p tsconfig.json
  • Once you all all of your dependencies have update to RxJs, remove rxjs-compat

Comments are closed