How to update each dependency in package.json to the latest version?

前端 未结 30 2896
清歌不尽
清歌不尽 2020-11-22 08:01

I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don\'t mind

30条回答
  •  心在旅途
    2020-11-22 08:33

    npm-check-updates is a utility that automatically adjusts a package.json with the latest version of all dependencies

    see https://www.npmjs.org/package/npm-check-updates

    $ npm install -g npm-check-updates
    $ ncu -u
    $ npm install 
    

    [EDIT] A slightly less intrusive (avoids a global install) way of doing this if you have a modern version of npm is:

    $ npx npm-check-updates -u
    $ npm install 
    

提交回复
热议问题