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

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

    I use npm-check to achieve this.

    npm i -g npm npm-check
    npm-check -ug #to update globals
    npm-check -u #to update locals
    

    Another useful command list which will keep exact version numbers in package.json

    npm cache clean
    rm -rf node_modules/
    npm i -g npm npm-check-updates
    ncu -g #update globals
    ncu -ua #update locals
    npm i
    

提交回复
热议问题