Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

131
Visualizações
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 Respostas
Responde à pergunta

0

this is all you need to do :')

import { http } from "http";
about 4 years ago · Juan Pablo Isaza Relatório

0

tsc --init

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

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda