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

前端 未结 30 2861
清歌不尽
清歌不尽 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:28

    I really like how npm-upgrade works. It is a simple command line utility that goes through all of your dependencies and lets you see the current version compared to the latest version and update if you want.

    Here is a screenshot of what happens after running npm-upgrade in the root of your project (next to the package.json file):

    For each dependency you can choose to upgrade, ignore, view the changelog, or finish the process. It has worked great for me so far.

    EDIT: To be clear this is a third party package that needs to be installed before the command will work. It does not come with npm itself:

    npm install -g npm-upgrade
    

    Then from the root of a project that has a package.json file:

    npm-upgrade
    

提交回复
热议问题