# NestJS v9 -> v10

The project was created with NestJS v9 and now it can be upgraded to v10. To achieve this using [ncu](https://www.npmjs.com/package/npm-check-updates), we should follow these steps:

* Install the latest node LTS version through nvm and activate it

```sh
nvm install lts
nvm use lts
```

* Install yarn (if you use it) and nest globally

```sh
npm i -g yarn @nestjs/cli
```

* Install ncu globally

```sh
npm i -g npm-check-updates
```

* Inside the project directory, use **ncu** to check available updates

```sh
ncu
```

* Update everything

```sh
ncu -u
```

* Change the **eslint** in <mark style="color:purple;">package.json</mark> back to v8, due to many breaking changes

```json
"eslint": "^8.0.0"
```

Then, we should update the <mark style="color:purple;">.gitignore</mark> file, by putting at the end of the <mark style="color:green;">#compiled output</mark> section:

```ignore
/build
```

And after the <mark style="color:green;"># IDE - VSCode</mark> section:

```ignore
# 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 <mark style="color:purple;">tsconfig.json</mark> file, alter the <mark style="color:blue;">target</mark> field to **ES2021**.

Finally, delete <mark style="color:purple;">yarn.lock</mark> and <mark style="color:purple;">node\_modules</mark>, and run <mark style="color:orange;">yarn</mark> to actually update the dependencies.

{% hint style="info" %}
If you are on **Windows** and want to switch the **line break** of your files back from LF to CRLF, you may perform the following steps:

* In the file <mark style="color:purple;">.prettierrc</mark>, set <mark style="color:blue;">`endOfLine`</mark> to <mark style="color:blue;">"crlf"</mark>
* In the terminal, run the following commands
  * <mark style="color:orange;">yarn format</mark>
  * <mark style="color:orange;">git config core.autocrlf true</mark>
* Set <mark style="color:blue;">`endOfLine`</mark> back to <mark style="color:blue;">"auto"</mark>
  {% endhint %}

<mark style="color:green;">**Commit**</mark> - Upgrading from NestJS v9 to v10


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kinesis-school-of-programming.gitbook.io/nestjs-unleashed/introduction/upgrading-packages-ncu/nestjs-v9-greater-than-v10.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
