Typescript - Cannot find module 'http' on Visual Studio Code

R3Tech picture R3Tech · Jul 18, 2016 · Viewed 15k times · Source

i'm using Visual Studio Code for NodeJS and Typescript development. If I'm writing this code:

import * as http from 'http'; 

The compile says error TS2307: Cannot find module 'http'.

How to handle this error?

Greetz

Answer

Isolated picture Isolated · Apr 18, 2017

This worked for me:

npm install @types/node --save

I realise it's been a while since the OP, however this is a more updated answer in case someone stumbles across this problem.