Skip to content

ERR_REQUIRE_ESM #143

Description

@xstable

I got this error-message if I try to run a deployment-script, which use cli-progress:

> DEPLOY_TYPE=production node scripts/deployment.cjs

start deployment.cjs
/home/me/myProject/node_modules/cli-progress/lib/formatter.js:1
const _stringWidth = require('string-width');
                     ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/me/myProject/node_modules/string-width/index.js from /home/me/myProject/node_modules/cli-progress/lib/formatter.js not supported.
Instead change the require of index.js in /home/me/myProject/node_modules/cli-progress/lib/formatter.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/home/me/myProject/node_modules/cli-progress/lib/formatter.js:1:22)
    at Object.<anonymous> (/home/me/myProject/node_modules/cli-progress/lib/generic-bar.js:3:20)
    at Object.<anonymous> (/home/me/myProject/node_modules/cli-progress/lib/single-bar.js:1:21)
    at Object.<anonymous> (/home/me/myProject/node_modules/cli-progress/cli-progress.js:1:20)
    at Object.<anonymous> (/home/me/myProject/node_modules/ssh-deploy-release/dist/Remote.js:19:21)
    at Object.<anonymous> (/home/me/myProject/node_modules/ssh-deploy-release/dist/ssh-deploy-release.js:15:16)
    at Object.<anonymous> (/home/me/myProject/scripts/deployment.cjs:3:18) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v18.16.0

Any Idea, how to fix this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions