How to Upgrade NestJS 9 to 10: A Developer's Guide

amirfakour

amir fakoor

Posted on June 25, 2023

How to Upgrade NestJS 9 to 10: A Developer's Guide

In this tutorial, we will walk through the process of upgrading a NestJS application from version 9 to 10. This guide is intended for developers who have an existing NestJS project and wish to update it to the latest version.

Step 1: Update the NestJS CLI
First, update the NestJS CLI to the latest version by running the following command:



npm install -g @nestjs/cli


Enter fullscreen mode Exit fullscreen mode

Verify the installed version with:



nest --version


Enter fullscreen mode Exit fullscreen mode

Step 2: Install npm-check-updates
To update your dependencies, install the npm-check-updates package globally:



npm i -g npm-check-updates


Enter fullscreen mode Exit fullscreen mode

Step 3: Update package.json
Use ncu -u to update your package.json file with the latest dependencies:



ncu -u -f /^@nestjs/


Enter fullscreen mode Exit fullscreen mode

Image description

Step 4: Verify Changes
Review the changes in your package.json file, ensuring that the NestJS dependencies are updated to the desired version (v10).

Step 5: Remove package-lock.json and node_modules
Delete the package-lock.json file and the node_modules folder with the following commands:



rm package-lock.json
rm -rf node_modules


Enter fullscreen mode Exit fullscreen mode

Step 6: Install Updated Dependencies
Finally, install the updated dependencies:



npm install


Enter fullscreen mode Exit fullscreen mode

Conclusion
After completing these steps, your NestJS application should be updated to version 10. Be sure to test your application thoroughly to ensure that there are no issues or breaking changes caused by the upgrade. Happy coding!

💖 💪 🙅 🚩
amirfakour
amir fakoor

Posted on June 25, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related