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!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
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
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.