Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 531
Sri Avatar asked Jan 03 '18 21:01

Sri


People also ask

How do I create a project with specific Angular version?

After complete the installation, just create new angular project into your specific folder that you recently install angular. Ex: d:\projects\demo\ . Now create angular project using the command ng new Project_name and it will create your specific angular version Project.

Which is the code used to create a new project in Angular?

ng newlink. Creates a new Angular workspace.

Where is Angular version in package json?

Checking the Angular VersionOpen the Terminal + view in your project and type ng version . For recent versions of Angular, this will list the versions of several Angular packages that you have installed in your project. Open the package. json file and examine the Angular packages referenced in your project.


1 Answers

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

npm install -g @angular/[email protected]

or

npm i -g @angular/cli@latest
like image 56
Zlatko Avatar answered Oct 15 '22 11:10

Zlatko