Nest-cli: What is the best way to update nest project dependencies

Created on 28 Jun 2019  路  6Comments  路  Source: nestjs/nest-cli

Hi i would like to understand what is the best possible way to upgrade a nestjs project dependencies. Currently i have nest cli version 6.5.0 which shows up when i run nest --version. I tried running nest update command to update the dependencies for one of my project that was having the following in package.json file:

        "@nest-modules/mailer": "^1.1.3",
        "@nestjs/common": "^6.0.0",
        "@nestjs/core": "^6.0.0",
        "@nestjs/jwt": "^6.0.0",
        "@nestjs/mongoose": "^6.1.2",
        "@nestjs/platform-express": "^6.0.0",
        "@nestjs/platform-socket.io": "^6.1.1",
        "@nestjs/swagger": "^3.0.2",
        "@nestjs/websockets": "^6.1.1",

I would like to know if there is a cli command to modify the dependency versions from 6.0.0 to the latest say 6.5.0

Most helpful comment

Hi, i tried a force update of dependencies with the command nest update -f -t latest and it did update my dependency to 6.3.2. Please let me know if its the correct way to do it

All 6 comments

Hi, i tried a force update of dependencies with the command nest update -f -t latest and it did update my dependency to 6.3.2. Please let me know if its the correct way to do it

Yes, it's the correct way to do it :) I'm slightly surprised that you have to use -f, but that's fine.

Yes, it's the correct way to do it :) I'm slightly surprised that you have to use -f, but that's fine.

When I run the command nest update -f -t latest and then run npm outdated I get this output:

image

These NestJS don't seem to get upgraded. Why aren't they included in the upgrade?

@bervol @kamilmysliwiec

These NestJS don't seem to get upgraded. Why aren't they included in the upgrade?

I just experienced the very same behavior. Why is that?

I believe the CLI updates the prod deps only at the moment. The update command is underpowered, so use it sparingly. We'll probably work on adding functionality to it as time goes on, but for now, things like yarn upgradeInteractive and npm-check are going to be a better bet when it comes to just updating dependencies.

I can recommend the npm-check-updates too https://www.npmjs.com/package/npm-check-updates

Was this page helpful?
0 / 5 - 0 ratings