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

465
Views
Module '"domhandler"' has no exported member 'DomElement'. Did you mean to use 'import DomElement from "domhandler"' instead?

I trying to build a react-typescript project. ii didn't install dom utils and HTML parser libraries. but when I tried to run yarn build, the following error is coming

       ~~~~~~~~~~

../node_modules/@types/htmlparser2/index.d.ts:17:10 - error TS2614: Module '"domhandler"' has no exported member 'DomElement'. Did you mean to use 'import DomElement from "domhandler"' instead?

17 export { DomElement, DomHandlerOptions, DomHandler, Element, Node } from 'domhandler';
            ~~~~~~~~~~

../node_modules/@types/react-html-parser/index.d.ts:9:10 - error TS2305: Module '"htmlparser2"' has no exported member 'DomElement'.

9 import { DomElement } from "htmlparser2";

I tried some of follwoing steps,

added "skipLibCheck": true in tsconfig.json file

https://github.com/apostrophecms/sanitize-html/issues/333 i tried some steps whatever they said, still no use.

tsconfig.json file

{
  /* https://www.typescriptlang.org/docs/handbook/react-&-webpack.html */
  /* https://www.typescriptlang.org/docs/handbook/compiler-options.html */
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs" /* webpack supports imports syntax */,
    "jsx": "react",
    "lib": ["es5", "dom", "es2015"],
    "strict": true,
    "moduleResolution": "node" /* load modules like node */,
    "esModuleInterop": true /* to treat commonJS 'module.exports' as 'default export' */,
    "importHelpers": true,
    "skipLibCheck": true,
  }
}

This might be a duplicate question. But I don't know how to solve this issue, can someone help me for solving this??

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Remove your current node_modules folder and package-lock.json file. Then after run the command,

npm cache clean --force

Then again install all the npm package

npm i

Better If you can keep -> "skipLibCheck": true in tsconfig.json. will help to resolve this issue further.

Then Try to Build the project again. Hopefully, the issue will be resolved.

over 4 years ago · Santiago Trujillo Report

0

If you have these errors just check your package.json. Possibly you installed unwanted type definitions because htmlparser2 package has all necessary type definitions from the box.

If so then delete it and use @Kasunaz's answer.

over 4 years ago · Santiago Trujillo 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!