close

[Solved] require() of ES modules is not supported. error with swagger-jsdoc

Hello Guys, How are you all? Hope You all Are Fine. Today I am trying to import swagger-jsdoc but I get an error require() of ES modules is not supported. error with swagger-jsdoc in JavaScript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How require() of ES modules is not supported. error with swagger-jsdoc Error Occurs ?

Today I am trying to import swagger-jsdoc but I get an error.

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: D:/Projects/swaggertest/node_modules/swagger-jsdoc/index.js require() of ES modules is not supported. require() of

How To Solve require() of ES modules is not supported. error with swagger-jsdoc Error ?

  1. How To Solve require() of ES modules is not supported. error with swagger-jsdoc Error ?

    To Solve require() of ES modules is not supported. error with swagger-jsdoc Error Seems to be a problem with swagger-jsdoc just downgrade swagger-jsdoc to 6.0.0. Here is what my package.json file now looks like.

Solution 1: just downgrade swagger-jsdoc to 6.0.0

Seems to be a problem with swagger-jsdoc just downgrade swagger-jsdoc to 6.0.0. Here is what my package.json file now looks like.

  "dependencies": {
    "express": "^4.17.1",
    "nodemon": "^2.0.7",
    "swagger-jsdoc": "6.0.0",
    "swagger-ui-express": "^4.1.6"
  }

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Please Rate Our Solution to Motivate Us For Give Our Best

Leave a Comment