You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a NodeJS program I use the ES module by specifying the type field inside the project. Also I created an ecosystem.config.js for PM2 usage purposes. But because the PM2 still using the CommonJS module, I gave it a cjs suffix
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /root/nodejs-app/index.mjs
at Module.load (internal/modules/cjs/loader.js:861:11)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Object.<anonymous> (/usr/local/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47 {
code: 'ERR_REQUIRE_ESM'
}
However, if I manually run the PM2 command in the VPS by myself everything would be fine. What’s wrong with the Github Action
The text was updated successfully, but these errors were encountered:
In a NodeJS program I use the ES module by specifying the type field inside the project. Also I created an ecosystem.config.js for PM2 usage purposes. But because the PM2 still using the CommonJS module, I gave it a cjs suffix
This is the ecosystem.config.js content:
This is the folder structure:
And I deploy the project to the DigitalOcean Droplet via Github Action SSH Remote Commands
After deployment I got this error:
However, if I manually run the PM2 command in the VPS by myself everything would be fine. What’s wrong with the Github Action
The text was updated successfully, but these errors were encountered: