JKHeadley / rest-hapi

🚀 A RESTful API generator for Node.js
https://resthapi.com
MIT License
1.19k stars 152 forks source link

Error [ERR_REQUIRE_ESM]: Can't start demo project. #292

Open RashiqAzhan opened 2 years ago

RashiqAzhan commented 2 years ago

Describe the bug Chalk in utilities is no longer supported.

To Reproduce Steps to reproduce the behavior: Follow the documentation steps in here.

Expected behavior The project starts normally like in the video.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Terminal Output:

.../rest-hapi-demo/node_modules/rest-hapi/utilities/log-util.js:2
const chalk = require('chalk')
^

Error [ERR_REQUIRE_ESM]: require() of ES Module .../rest-hapi-demo/node_modules/rest-hapi/node_modules/chalk/source/index.js from .../rest-hapi-demo/node_modules/rest-hapi/utilities/log-util.js not supported.
Instead change the require of index.js in .../rest-hapi-demo/node_modules/rest-hapi/utilities/log-util.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (.../rest-hapi-demo/node_modules/rest-hapi/utilities/log-util.js:2:15)
at Object.<anonymous> (.../rest-hapi-demo/node_modules/rest-hapi/rest-hapi.js:12:17)
at Object.<anonymous> (.../rest-hapi-demo/api.js:3:16) {
code: 'ERR_REQUIRE_ESM'
}