Error [ERR_REQUIRE_ESM]: require() of ES Module E:\node-course\notes-app\node_modules\chalk\source\index.js from E:\node-course\app.js not supported. Instead change the require of index.js in E:\node-course\app.js to a dynamic import() which is available in all CommonJS modules. at Object. (E:\node-course\notes-app\app.js:8:15) { code: ‘ERR_REQUIRE_ESM’

By | May 22, 2022

Error [ERR_REQUIRE_ESM]: require() of ES Module E:\node-course\notes-app\node_modules\chalk\source\index.js from E:\node-course\app.js not supported.
Instead change the require of index.js in E:\node-course\app.js to a dynamic import() which is available in all CommonJS modules. at Object.<anonymous> (E:\node-course\notes-app\app.js:8:15) {
code: ‘ERR_REQUIRE_ESM’

 

Solution is use lower version of chalk —¬†npm install chalk@4.1.2