I realize that doing this would not be so easy.
But lately (I had run Node.js apps successfully on a shared server in the past 2 years) it seems well-nigh impossible.
I can create the app no issues and apparently get it started.
I can SSH into the app's folder - though of course as this is not the terminal window that started the Node.js app and I see no sign of a running Node app, for example a console log message like:
This document from InMotion Hosting says we can use the command at the top of the Node.js creation window to enter the Node.js application's environment via SSH from one's local machine or via the Terminal feature on the cPanel.
I successfully entered the Node app's environment via this command to Terminal.
I stopped the Node.js app via the cPanel STOP button and then tried to restart it again via the Terminal command:
So although "stopped" the app nonetheless hogs the server port 3001, preventing anyone but the server root to start it.
Funnily enough when my website posts AJAX requests to the Node server all I get is a 503 error.
"Service unavailable . . ."
I should mention that I put a redirect into my website's home folder's .htaccess file :
The behavior of this app on the server resembles its behavior on a local machine when I neglect to turn on Node.js . . .
But lately (I had run Node.js apps successfully on a shared server in the past 2 years) it seems well-nigh impossible.
I can create the app no issues and apparently get it started.
I can SSH into the app's folder - though of course as this is not the terminal window that started the Node.js app and I see no sign of a running Node app, for example a console log message like:
$ NodeApp listening on port 3001 . . .
This document from InMotion Hosting says we can use the command at the top of the Node.js creation window to enter the Node.js application's environment via SSH from one's local machine or via the Terminal feature on the cPanel.
I successfully entered the Node app's environment via this command to Terminal.
I stopped the Node.js app via the cPanel STOP button and then tried to restart it again via the Terminal command:
$ node app.jsnode:events:491 throw er; // Unhandled 'error' event ^
Error: listen EADDRINUSE: address already in use :::3001
at Server.setupListenHandle [as _listen2] (node:net:1432:16)
at listenInCluster (node:net:1480:12)
at Server.listen (node:net:1568:7)
at Object.<anonymous> (/home/zmail/nodeapp/app.js:145:13)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
Emitted 'error' event on Server instance at:
at emitErrorNT (node:net:1459:8)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 3001
}
$
So although "stopped" the app nonetheless hogs the server port 3001, preventing anyone but the server root to start it.
Funnily enough when my website posts AJAX requests to the Node server all I get is a 503 error.
"Service unavailable . . ."
I should mention that I put a redirect into my website's home folder's .htaccess file :
RewriteEngine On
RewriteRule ^nodeapp/(.*) [URL]https://localhost:3001/$1[/URL] [P,L]
The behavior of this app on the server resembles its behavior on a local machine when I neglect to turn on Node.js . . .
Last edited by a moderator: