Update Angular to newer version VS 2017

I am new to node, npm and angular. I picked up this book called 'ASP NET CORE and Angular 5' from packet publishing. I am setting up the environment as specified in the book.

I created a project with default template so it came with angular 4.2.5

I changed the version number from 4.2.5 to 5.0.5 in the package.json and rebuilt the solution but I'm still seeing under dependencies/npm 4.2.5 version. The book said to manually update if this doesn't work. I Performed that step as well, under the image, still seeing the same result.

enter image description here

From inside the root folder, i am trying to run the batch file with the following commands to update. I double clicked on it. The command prompt was showing doing an update...

cd %~dp0
npm update

enter image description here

and here is the dependencies/npm folder after the updates. Still showing 4.2.5

enter image description here

I have followed some other npm update questions already asked but nothing seem to be updating the project for me. How should i update this test project.

1 answer

  • answered 2018-04-17 04:18 Fire

    From this stackoverflow question, you can do this:

    npm uninstall -g angular-cli
    npm cache clean
    npm install -g @angular/cli@latest

    The -g mean global, therefore you will be updating angular system wide and will need admin priviledges.
    In a more general way, you can always delete recursively your node_modules folder and run npm install to get all your packages to the version specified in your package.json file.