la-haute-societe / ssh-deploy-release

Deploy releases over SSH with rsync, archive ZIP / TAR, symlinks, SCP ...
https://www.npmjs.com/package/ssh-deploy-release
MIT License
36 stars 10 forks source link

Error Message about: ERR_REQUIRE_ESM #37

Open xstable opened 1 year ago

xstable commented 1 year ago

I try to run my deploy-script, but got this error:

> 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

As you see in the above output, the error appears right before the second console.log, so the issue must be on ssh-deploy-release and it's dependencies.

image