1

I want to use node js chalk module but I am getting the following error

let chalk = require('chalk');
            ^

Error [ERR_REQUIRE_ESM]: require() of ES Module F:\Bhaskar\Learning\CompleteWebDevelopmentCourse\node_modules\chalk\source\index.js from F:\Bhaskar\Learning\CompleteWebDevelopmentCourse\NodeJs\npm.js not supported.
Instead change the require of index.js in F:\Bhaskar\Learning\CompleteWebDevelopmentCourse\NodeJs\npm.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (F:\Bhaskar\Learning\CompleteWebDevelopmentCourse\NodeJs\npm.js:1:13) {
  code: 'ERR_REQUIRE_ESM'
}
Bhaskar Jyoti Dutta
  • 1,740
  • 2
  • 15
  • 30
  • Does this answer your question? [chalk - Error \[ERR\_REQUIRE\_ESM\]: require() of ES Module](https://stackoverflow.com/questions/70309135/chalk-error-err-require-esm-require-of-es-module) – ranjanistic Oct 21 '22 at 14:23

0 Answers0