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

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

    The above commands are unsafe because you might break your module when switching versions. Instead I recommend the following

    • Set actual current node modules version into package.json using npm shrinkwrap command.
    • Update each dependency to the latest version IF IT DOES NOT BREAK YOUR TESTS using https://github.com/bahmutov/next-update command line tool
    npm install -g next-update
    // from your package
    next-update
    

提交回复
热议问题