NestJS v9 -> v10
The project was created with NestJS v9 and now it can be upgraded to v10. To achieve this using ncu, we should follow these steps:
Install the latest node LTS version through nvm and activate it
nvm install lts
nvm use lts
Install yarn (if you use it) and nest globally
npm i -g yarn @nestjs/cli
Install ncu globally
npm i -g npm-check-updates
Inside the project directory, use ncu to check available updates
ncu
Update everything
ncu -u
Change the eslint in package.json back to v8, due to many breaking changes
"eslint": "^8.0.0"
Then, we should update the .gitignore file, by putting at the end of the #compiled output section:
/build
And after the # IDE - VSCode section:
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# temp directory
.temp
.tmp
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
In the tsconfig.json file, alter the target field to ES2021.
Finally, delete yarn.lock and node_modules, and run yarn to actually update the dependencies.
Commit - Upgrading from NestJS v9 to v10
Last updated