# Fix Node.js imports types errors in VS Code

> How to fix VS Code complaining that Node.js types cannot be found, by installing @types/node, adding it to tsconfig, and restarting the editor.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2023-10-25 | Topics: [Node.js](https://flaviocopes.com/tags/node/) | Canonical: https://flaviocopes.com/fix-nodejs-imports-types-errors-in-vs-code/

Had this error (more a warning) in a project:

![VS Code showing TypeScript errors with red underlines on Node.js imports for fs, process, and path modules](https://flaviocopes.com/images/fix-nodejs-imports-types-errors-in-vs-code/1.webp)

VS Code complained [Node.js](https://flaviocopes.com/nodejs/) types could not be found.

So I installed them:

```
npm install -D @types/node
```

Then added them to the compilerOptions in `tsconfig.json`

```json
{
  //...
  "compilerOptions": {
    "types": [
      "node"
    ]
  },
}

```

That still didn't solve so I dropped node_modules:

```bash
rm -rf node_modules
rm -f package-lock.json
npm cache clean --force
npm install
```

Finally, restarting VS Code made them disappear (not sure if reinstalling modules had any effect, first try restarting VS Code after adding the types).
