Search code examples
node.jscommand-linemodulenpmpackage

How can I update all npm packages/modules at once?


I'm struggling to find a way to update all npm packages in one go, some articles suggest that package.json file should be edited where all version numbers need to be changed to * therefore forcing node to grab latest versions, but others state that such method is not considered good. Ideally, I want to find a command line option for this.


Solution

  • One simple step:

    $ npx npm-check-updates -u && npm i
    

    This will set all of your packages in package.json to the latest version and apply the updates.