Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Node http module is not found when using from typescript
$ node -v
v16.13.0

I'm very new to TS/JS and try to understand how to import modules provided by node js with typescript. Following this How to use Node http module in TypeScript QA I tried it myself and wrote the following simple typescript file:

import * as http from "http"

When running tsc main.ts I got the following error:

main.ts:1:23 - error TS2307: Cannot find module 'http' or its 
corresponding type declarations.

Maybe some more options are required to the tsc? I tried to add tsc --module commonjs main.ts but got the same error.

I thought all node js modules are visible for typescript by default.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

this is all you need to do :')

import { http } from "http";
about 4 years ago · Juan Pablo Isaza Report

0

tsc --init

To initialize the Typescript configuration file. The error disappeared for me.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!