NodeJS: Update all the packages to current versions with NPM
I downloaded a repository from github and decided to install the packages. I entered ‘npm install’ but as a result I’ve got a lot of messages that packages are deprecated and some errors. As I could see in the log files, the problem was connected with old packages. So I wanted to update all the packages in package.json.
At first I wanted to update the package versions, but as soon as I have counted the quantity, I decided not to do it and to look for the way how to make it automatically. As it turned out, I am not the only one who is looking for this.
The solution was found very quickly, it consists of 3 sequential commands:
npm i -g npm-check-updates
ncu -u
npm install
To execute the first command (npm i -g npm-check-updates) I had to use ‘sudo’.