0

Getting error of Error [ERR_REQUIRE_ESM] while deploying nuxtjs 2 application.

Scripts:

"build": "nuxt build",

"start": "./node_modules/pm2/bin/pm2 start pm2.config.json"

Errors:

Error [ERR_REQUIRE_ESM]: require() of ES Module /var/app/current/node_modules/string-width/index.js from /var/app/current/node_modules/wrap-ansi/index.js not supported.

Instead change the require of /var/app/current/node_modules/string-width/index.js in /var/app/current/node_modules/wrap-ansi/index.js to a dynamic import() which is available in all CommonJS modules.

at Module.Hook._require.Module.require (/var/app/current/node_modules/require-in-the-middle/index.js:80:39)

at Object. (/var/app/current/node_modules/@nuxt/cli/dist/cli-index.js:15:18)

at Object. (/var/app/current/node_modules/nuxt/bin/nuxt.js:6:1)

at /var/app/current/node_modules/pm2/lib/ProcessContainer.js:303:25

at wrapper (/var/app/current/node_modules/async/internal/once.js:12:16)

at WriteStream. (/var/app/current/node_modules/pm2/lib/Utility.js:186:13)

at WriteStream.emit (node:events:527:28)

at FSReqCallback.oncomplete (node:fs:188:23)

EDIT:

AWS EC2 : upgrade from AMI 1 to AMI 2

Node: 16.15.1

Npm: 8.11.0

ks221197
  • 1
  • 1

0 Answers0