Must use import to load ES Module in Nuxt3 #19271
-
EnvironmentReproductionRepo Demo Describe the bugI am try to deploy this test nuxt app in my node machine, as Passenger apps. So far, i was not able to get it working, and not sure how to go about this. Perhaps, you have another suggestion to make it work. So far, here is my setup tied to running Passenger apps in node In running However, when i visit the Passenger app in node, see demo site This returns; Any suggestion? Additional contextNo response Logs[ E 2023-02-24 22:57:05.1678 2999/T2x age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /home/virtual/site3/fst/var/www/nuxt-sample.kurtobando.com: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger.
Error ID: 6ce28159
Error details saved to: /tmp/passenger-error-f9xktp.html
Message from application: An error occurred while starting the web application. It exited before signalling successful startup back to Phusion Passenger. Please read <a href="https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems">this article</a> for more information about this problem.<br>
<h2>Raw process output:</h2>
<pre>
internal/modules/cjs/loader.js:926
throw new ERR_REQUIRE_ESM(filename);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/www/nuxt-sample.kurtobando.com/.output/server/index.mjs
at Module.load (internal/modules/cjs/loader.js:926:11)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at Module.require (/.socket/passenger/src/helper-scripts/node-loader.js:80:25)
at require (internal/modules/cjs/helpers.js:88:18)
at loadApplication (/.socket/passenger/src/helper-scripts/node-loader.js:266:2)
at setupEnvironment (/.socket/passenger/src/helper-scripts/node-loader.js:231:2)
at /.socket/passenger/src/helper-scripts/node-loader.js:154:5
at LineReader.readLine (/.socket/passenger/src/nodejs_supportlib/phusion_passenger/line_reader.js:124:3)
at readNextOption (/.socket/passenger/src/helper-scripts/node-loader.js:152:15) {
code: 'ERR_REQUIRE_ESM'
}
</pre> |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
Create a .js file with content |
Beta Was this translation helpful? Give feedback.
-
|
I am getting the same problem after updating Nuxt to v3.10.1 but only when I try to run my app using pm2. Can someone explain @ |
Beta Was this translation helpful? Give feedback.



Create a .js file with content
import("./index.mjs");and set it as application startup file in Setup Node.js App.The parameter for import should be the location of index.mjs in server folder