nestjs

Is there a recommended way to update NestJS?


I'm currently using 6.0.4, I'd like to get to 6.5.2. What is the best way to do this? Is there something in the CLI? Do I manually update each @nestjs package?

Current dependencies are:

    "@nestjs/common": "^6.0.4",
    "@nestjs/core": "^6.0.4",
    "@nestjs/microservices": "^6.0.4",
    "@nestjs/passport": "^6.1.0",
    "@nestjs/platform-express": "^6.0.4",
    "@nestjs/swagger": "^3.0.2",

Solution

  • You can use the Nest CLI to update the dependencies:

    $ npm install -g @nestjs/cli
    $ nest update
    

    You can also $ nest u

    As Mick mentioned in his comment, you might have to add --force argument.

    nest update --force
    

    Update - July 7 2022

    Since v9.0.0 release, the command update was removed. To upgrade your dependencies, you can use dedicated tools like ncu, npm update, yarn upgrade-interactive, etc.