javascriptangularnpmprojectnpm-update

Angular new project creation through ng new command is creating package.json with old versions


I am trying to create a new Angular project through ng new command

ng new <angularProjectName>

On navigating inside the newly created project and checking the package.json file, and it has older versions in dependecies and dev dependencies

I tried to uninstall angular-cli and install latest @angular/cli through this https://github.com/angular/angular-cli

I checked for the outdated npm packages - using npm outdated and got the list

Package                            Current  Wanted  Latest  Location
@angular/common                     2.4.10  2.4.10   5.1.2  ang2
@angular/compiler                   2.4.10  2.4.10   5.1.2  ang2
@angular/compiler-cli               2.4.10  2.4.10   5.1.2  ang2
@angular/core                       2.4.10  2.4.10   5.1.2  ang2
@angular/forms                      2.4.10  2.4.10   5.1.2  ang2
@angular/http                       2.4.10  2.4.10   5.1.2  ang2
@angular/platform-browser           2.4.10  2.4.10   5.1.2  ang2
@angular/platform-browser-dynamic   2.4.10  2.4.10   5.1.2  ang2
@angular/router                     3.4.10  3.4.10   5.1.2  ang2
@types/jasmine                      2.5.38  2.5.38   2.8.3  ang2
@types/node                         6.0.95  6.0.95   8.5.5  ang2
codelyzer                            2.0.1   2.0.1   4.0.2  ang2
jasmine-core                         2.5.2   2.5.2   2.8.0  ang2
jasmine-spec-reporter                2.5.0   2.5.0   4.2.1  ang2
karma                                1.2.0   1.2.0   2.0.0  ang2
karma-remap-istanbul                 0.2.2   0.2.2   0.6.0  ang2
protractor                          4.0.14  4.0.14   5.2.2  ang2
ts-node                              1.2.1   1.2.1   4.1.0  ang2
tslint                               4.5.1   4.5.1   5.8.0  ang2
typescript                          2.0.10  2.0.10   2.6.2  ang2
zone.js                              0.7.8   0.7.8  0.8.19  ang2

I also tried to update the package.json through

npm update

But no success here also. I am not sure what I am missing here, my requirement is pretty simple When i create a new angular project through ng new command, I want package.json to have the latest angular versions and How can I update an already existing project's package.json version to reflect the latest version of angular

I tried both uninstalling and reinstalling @latest of @anguarl/cli and npm update but of no use.


Solution

  • You have the old angular-cli version. Try this:

    npm install -g @angular/cli@1.6.3
    

    or

    npm i -g @angular/cli@latest