Upgrading node modules to the updated version.

AWDESH
2 min readJun 4, 2018

Node modules get version upgrades quite frequently which can be quite annoying and time-consuming if proper measures aren’t used to upgrade them. Luckily, there are npm modules like npm-check-updates a.k.a ‘ncu’ to take care of that business for us.

ncu is just another npm module that parse package.json inside node project and outputs list of different modules that requires update. Using -u flag with it we can update all of the modules to the newer version.

Under the root user install ‘ncu’ module globally. Simply install it like below-:

$ npm install -g ncu

Once installed globally you can switch user and go to your node project directory and now you can use ‘ncu’ simply by running commands like below.

$ ncu

above command will parse package.json and outputs you all the modules that needs to be upgraded.

You can review output and if it looks good to you it’s time to run

$ ncu -u

to update all the node modules in the package.json.

Once you have the new version in package.json, it’s a good time to run npm install so you get new versions installed inside node_modules directory under your project.

There is another nice npm module called ‘bower-check-updates’ a.k.a bcu for front-end projects where bower.json is still used and does the exact same thing as ncu. It gets installed globally like ncu and you can do bcu and bcu -u in order to upgrade front end node modules.

--

--

AWDESH

Learner, Philomath. Engineer by choice, humorous by nature. Big fan of technology.