Getting error while using node js "chalk" module

462 views Asked by At

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'
}
0

There are 0 answers