How to update / upgrade from Angular 4 to Angular 5+

Solution 1:

The problem was fixed with Node version update.

I had to update Node version,

sudo apt-get install nodejs

npm uninstall -g @angular/cli

npm cache clean

npm install -g @angular/cli@latest

ng new ProjectName

node --version ==> 8.9.0

ng --version ==> 1.5.0

"dependencies": {
    "@angular/animations": "^5.0.0",
    "@angular/common": "^5.0.0",
    "@angular/compiler": "^5.0.0",
    "@angular/core": "^5.0.0",
    "@angular/forms": "^5.0.0",
    "@angular/http": "^5.0.0",
    "@angular/platform-browser": "^5.0.0",
    "@angular/platform-browser-dynamic": "^5.0.0",
    "@angular/router": "^5.0.0",
    "rxjs": "^5.5.2",
    "zone.js": "^0.8.14"
}

Solution 2:

Here's the correct answer, and it's super simple.

Follow the official Angular upgrade guide.

You'll fill out a short form selecting which version of Angular you are on and which version you want to upgrade to. It then shows you the list of necessary steps to take to perform the upgrade. You should follow this guide for all upgrades. (Please upvote before navigating away) :)

https://update.angular.io/

enter image description here

Solution 3:

Check Angular blog out

https://blog.angular.io/version-5-0-0-of-angular-now-available-37e414935ced

In the article, an update guide is mentioned.

You can find it here: https://angular-update-guide.firebaseapp.com/

Also, you can update your angular-CLI to 1.5.0 which will create angular v5 project. You can compare the differences with yours.