npm installing wrong version of anuglar(8.1.0)

Viewed 385

when i run the following command, it shows 6.4.1.

npm run ng --version

but when i am running the following command, it is installing 8.1.0 and getting error. i do not understand how it is happening.

npm install -g @angular/cli

i tried the following commands. but it is not working

npm cache clean --force
npm install -g @angular/cli

Error Screen

enter image description here

My Requirement:

Angular 6

how can i resolve this?

2 Answers

You should the latest (12+) node when upgrading to angular 8. You can download it from here.

After upgrading node, the issues should go away.

For simple use cases and thanks to the work done in Angular 8, you can upgrade to the latest release using one command:

$ ng update @angular/cli @angular/core

After running this command, the lazy loaded routes will be automatically migrated to the new import syntax which is standard compliant and brings Angular close to the open web platform.

You also need to be aware of the following issues when upgrading your project:

Angular 8 makes use of the latest TypeScript 3.4, so even if the upgrade process completes with success you might have some syntax errors that may be due to the better type inference system used by the latest version which detects new potential typing issues but in the end this will improve your code quality and helps you avoid bugs in the future. You can see the new features of TypeScript 3.4 from the official docs.

You need to have Node.js 12+. Simply run node -v to verify your Node version. You can install the latest version from the official website

Related