• Home
  • Jobs
  • Courses
  • Questions
  • Teachers
  • For business
  • ES/EN

0

116
Views
Module '"http"' has no default export. While using typescript And Node
    import http from 'http';
    http.createServer((req, res) => {
      res.end('Hello World');
    }).listen(3000, () => console.log('Port is running on 3000'));

I am using @types/node but it shows an error HTTP module does not have default export.

4 months ago ·

Santiago Trujillo

2 answers
Answer question

0

You probably need to import the module like this

import * as http from 'http'

4 months ago · Santiago Trujillo Report

0

To be honest with you, it's probably not an import problem as the first answer points out, import http from 'http' works more than fine. The issue is in the IDE to be more specific an indexing/memory issue, so what you do?

Restart

4 months ago · Santiago Trujillo Report
Answer question
Find remote jobs
Loading

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2022 PeakU Inc. All Rights Reserved.