admin管理员组文章数量:1402923
i have been trying to deploy a Node js app built using ES module in CPANEL but whenever i run the server i get this error from require
Node.js v20.18.2
/usr/local/lsws/fcgi-bin/lsnode.js:48
var app = require(startupFile);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/royalsecret/server/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'
}
I have been getting error 503 when i run end points, please any help will be appreciated.
Currently i have set the node version to v20.18.2 which was available to cpanel and my app node version is v22.3.0
本文标签: nodejsCpanel require () problem for node js using ES moduleStack Overflow
版权声明:本文标题:node.js - Cpanel require () problem for node js using ES module - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744351862a2602098.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论