How to update Node version
Every now and then we have to update the version of Node in your machine and your application repository and following are the generic steps I take to update mine.
The steps are generic you can use them to update to any x version.
Check you current node and npm version with below cmd
npm -v
node -v
First of all update your machine. you can download it from the node website
after the update if you use the same cmds it will should show you different version to update the npm version you use the below cmds
npm install -g npm@latest
Updating the Repo:
for example if you are updating from Node 12.10 to Node 14.21 then go to your visual studio code and search for the 12.10 and change all the relevent node version to 14.21, change the npm version too then do
npm i
after the npm i use the below cmd to check what dependencies are out of date now
npm outdated
in the above image you can see that it is will show you what is the current version of dependency, what is the wanted version and what is the latest version of dependency available.
now run the below cmd
npm update
It will run and remove some dependencies, it also works as clean up and it will also update ur dependencies to the wanted version. now id you run the npm outdated again the dependency report would have changed significantly. see below image for reference.
Now build and run your application again to make sure the update has not broken any thing commit your changes in your git branch.
After the initial commit you can check the dependencies that have breaking changes read their release doc and competiability with ur current node version and make changes accordingly.
happy coding.