2

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.

Smokey Dawson
  • 8,827
  • 19
  • 77
  • 152
learning...
  • 3,104
  • 10
  • 58
  • 96

1 Answers1

6

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.

Fire
  • 393
  • 1
  • 7
  • Thanks! my mistake... was running npm commands from node command prompt rather than regular one. First step it needs to be `npm cache verify`. I am now updated to latest version (1.7.4) globally. Then did npm install and the project has 5.0.5 as specified in the config file. – learning... Apr 17 '18 at 05:07
  • @learning... do you run this commands before or after changing the package.json file manually ? – AnaCS Jan 24 '19 at 18:11
  • My package.json file was already changed. In this case it doesn't matter. Once every thing is installed, change package file before issuing 'npm install'. – learning... Jan 24 '19 at 20:09