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",
First, we install two packages @nestjs/cli and npm-check-updates globally or as so-called devDependency. In this article, we go for the global approach. We need npm-check-updates because the NestJS CLI doesn't cover every single package from NestJS.
The Nest CLI is a command-line interface tool that helps you to initialize, develop, and maintain your Nest applications. It assists in multiple ways, including scaffolding the project, serving it in development mode, and building and bundling the application for production distribution.
NestJS is an open-source, extensible, versatile, progressive Node. Js framework for creating compelling and demanding backend systems. It's currently the fastest-growing Node. Js framework in TypeScript.
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
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.
Force update with the command:
nest update -f -t latest
nest info
_ _ _ ___ _____ _____ _ _____
| \ | | | | |_ |/ ___|/ __ \| | |_ _|
| \| | ___ ___ | |_ | |\ `--. | / \/| | | |
| . ` | / _ \/ __|| __| | | `--. \| | | | | |
| |\ || __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
\_| \_/ \___||___/ \__|\____/ \____/ \____/\_____/\___/
[System Information]
OS Version : macOS Catalina
NodeJS Version : v12.16.1
NPM Version : 6.13.4
[Nest Information]
platform-express version : 7.4.2
microservices version : 7.4.2
common version : 7.4.2
core version : 7.4.2
You can check at this post
Nest Docs: nest update
The way I handle this is to manually update each package. It's a little tedious but it gives you full control of what versions each package is set at.
I will usually create a "feature" branch in git, something like feature/upgrade
where I'll update the packages
npm i @nestjs/common@latest @nestjs/core@latest ...
Try it out there, then merge that branch into master (or whatever your development branch is). Git removes the need for "copying" code from another directory, if the new package versions breaks something, you have time to fix them in the feature branch before rolling out to production.
npx nest update -f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With