So I already deployed my website Nodejs + MySQL, but the problem is I get an error of
503 Service Unavailable The server is temporarily busy, try again later!
so I saw a thread : Instead change the require of index.js, to a dynamic import() which is available in all CommonJS modules, I followed the thread and install the
npm i node-fetch@2.6.1
after that, I also went back to my setup nodejs
and stop the process and npm install
it again and received the same error, when I check my stderr.log
i get an error of this
/usr/local/lsws/fcgi-bin/lsnode.js:48 var app = require(startupFile); ^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/ppsconl2/nodejs/index.js from /usr/local/lsws/fcgi-bin/lsnode.js not supported.
Instead change the require of index.js in /usr/local/lsws/fcgi-bin/lsnode.js to a dynamic import() which is available in all CommonJS modules.
at startApplication (/usr/local/lsws/fcgi-bin/lsnode.js:48:15)
at Object.<anonymous> (/usr/local/lsws/fcgi-bin/lsnode.js:16:1) {
code: 'ERR_REQUIRE_ESM'
}
this is my package.json
{
"name": "api",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon index.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"express": "^4.18.2",
"mysql2": "^3.2.0",
"nodemon": "^2.0.21"
}
}
The hosting's node js is v18.9.1
while in my pc is v18.14.1