0

Error image :

enter image description here

I don't quite understand the error message:

Error TS1259 (TS) Module '"D:/CloudStorage/..../node_modules/@types/body-parser/index"' can only be default-imported using the 'esModuleInterop' flag

I don't quite understand how to resolve the error

XouDo
  • 945
  • 10
  • 19
Indrajeet Haldar
  • 163
  • 1
  • 13

3 Answers3

0

You can try installing typescript library for body-parser:

npm i @types/body-parser
0

That should do it

import * as bodyParser from "body-parser"
Kabeer Jaffri
  • 652
  • 1
  • 9
  • 9
  • im not sure but. because body-parser does not have a ES default export. so we import all of the exported functions as default. refer to this post: https://stackoverflow.com/a/31387018/12067977 – Kabeer Jaffri May 14 '21 at 01:28
-1

fixed it -

import bodyParser = require('body-parser');

solved it, any ideas why this worked?

Indrajeet Haldar
  • 163
  • 1
  • 13