Debugging: Fix Node.js imports types errors in VS Code

Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026

The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.


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

VS Code complained Node.js types could not be found.

So I installed them:

npm install -D @types/node

Then added them to the compilerOptions in tsconfig.json

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

That still didn’t solve so I dropped node_modules:

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).

Lessons in this unit:

0: Introduction
1: ▶︎ Fix Node.js imports types errors in VS Code
2: referenceerror: window is not defined, how to solve
3: Use the Chrome DevTools to debug a Node.js app
4: Error handling in Node.js
5: How to solve the `util.pump is not a function` error in Node.js