Hello, i have been getting bad gateaway error in my MERN application. with pm2 logs, i have these errors:
/root/.pm2/logs/server-error.log last 15 lines:
0|server | at Module.load (internal/modules/cjs/loader.js:928:32)
0|server | at Function.Module._load (internal/modules/cjs/loader.js:769:14)
0|server | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
0|server | at internal/main/run_main_module.js:17:47
0|server | Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /root/GottaGetGamesWeb/backend/server.js
0|server | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
0|server | at Module.load (internal/modules/cjs/loader.js:928:32)
0|server | at Function.Module._load (internal/modules/cjs/loader.js:769:14)
0|server | at Object.<anonymous> (/root/.nvm/versions/node/v14.15.5/lib/node_modules/pm2/lib/ProcessContainerFork.js:48:21)
0|server | at Module._compile (internal/modules/cjs/loader.js:1063:30)
0|server | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
0|server | at Module.load (internal/modules/cjs/loader.js:928:32)
0|server | at Function.Module._load (internal/modules/cjs/loader.js:769:14)
0|server | at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
0|server | at internal/main/run_main_module.js:17:47
please help me.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hi there @heysuneel,
It sounds like that your Node.js version might be outdated. You can check this with the following command:
node -v
Starting from Node.js version 12.14.1, you should not get that error.
You could use NVM to install specific Node.js versions:
https://www.digitalocean.com/community/tutorials/nodejs-node-version-manager
Let me know how it goes. Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.