Upgrade all npm packages to the latest major version at once

While this may look like a dangerous idea, it is actually something that many of us wanted to do just to get rid of those warnings when we run npm install.

In the latest project, I upgraded my webpack config, and to my surprise, I could run the project and got zero errors.

Of course, I was lucky, and you may end up with some errors/warnings that you may need to fix yourself, but in the end you will use the latest versions of each package that is required. 🙂 Doing so you’ll get fewer worries about security so much anymore.

You can run the following command to see all outdated packages:

npm outdated

This one will give you a good image of what you should do.

Next, install a global package:

npm install -g npm-check-updates

After the installation is complete, run the following command:

ncu -u

This will update the numbers from package.json, but not the packages code. To do so, run npm install and you are done:

npm i

Now to hardest part is to test the code with the new packages. 🙂

Andrew
Member since January 2, 2019

Fullstack Web Developer with more than 12 years of experience in web development. Adept in all stages of advanced web development. Knowledgeable in the user interface, backend, testing, and debugging processes. Bringing forth expertise in design, installation, testing, and maintenance of web systems. Working exclusively and professionally with WordPress since 2010.

Comments

    Avatar

    Your email address will not be published. Required fields are marked *