Implement a node server without using Express.js

This is the repo GitHub - amethystnetwork-dev/Incognito: Unofficial Incognito easy deployment version with TompHTTP bare server included.

npm install
npm start

I need help doing this since I am a beginner to VPS and don’t know how to run a node project on CyberPanel.

Hello @Augustus

Kindly search the forum first before raising a topic

At the end you will understand to run nodejs apps.

As far as I have tested only SSG apps run without issues because you deploy them using express (this is the cyberpanel way). An SSR app can fail to run due to many issues.

As far as I see what this project is all about - its a node server running ipaddr.js under the hood. This might actually work. Also If I was you I would create .env for the server deployment since it uses port 8000 you may need to direct it to port 3000 Try deploy with pm2 see what happens

I followed the steps and did

npm start

But the website only works on port 4000 how do I change it so it works on
https://domain.com/ not a port.

Change port from 4000 to 3000 or 3001

It still don’t work. It tried both 3000 and 3001.

What error are you getting ?

When I go to the http://domain.com/ it just keeps loading but when you put it on a port http://domain.com:3000 it works

Then everything worked code-wise. Check your context now/ It should look something like

context / {
  type                    appserver
  location                /home/mynodejsdomain.com/public_html
  binPath                 /usr/bin/node 
  appType                 node
  maxConns                100
 
  rewrite  {
 
  }
  addDefaultCharset       off
}

I did it and still doesn’t work. Also, it only works on http not https. On https it says 404 not found. In addition, I have no .htaccess file.

Install pm2 so that you know which errors you are running into using pm2 monit. Just go to

$ cd /home/myincognitodeployment.com/public_html
$ npm -i -g pm2
$ pm2 startup src/index.js --name "incognito" --watch
$ pm2 startup && pm2 save
$ pm2 monit

When I run

$ pm2 startup src/index.js --name "incognito" --watch

It gives me this error

Please verify that your choice is indeed your init system
 If you arent sure, just run : pm2 startup
-----------------------------------------------------------
/usr/local/lib/node_modules/pm2/lib/API/Startup.js:324
      throw new Error('Unknown platform / init system name');
      ^

Error: Unknown platform / init system name
    at API.CLI.startup (/usr/local/lib/node_modules/pm2/lib/API/Startup.js:324:13)
    at Command.<anonymous> (/usr/local/lib/node_modules/pm2/lib/binaries/CLI.js:707:9)
    at Command.listener (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:315:8)
    at Command.emit (node:events:513:28)
    at Command.parseArgs (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:651:12)
    at Command.parse (/usr/local/lib/node_modules/pm2/node_modules/commander/index.js:474:21)
    at Timeout._onTimeout (/usr/local/lib/node_modules/pm2/lib/binaries/CLI.js:206:15)
    at listOnTimeout (node:internal/timers:559:17)
    at processTimers (node:internal/timers:502:7)

Run it. Which server os is this ?

Now what. I did pm2 startup && pm2 save and pm2 monit

On pm2 monit monitoring screen has your app started? do you see any errors ?

no. I don’t.

It looks like this:
Screen Shot 2023-03-17 at 4.02.28 PM

Well that was futile.

Can you do a last try and reboot your server.

Open pm2 monit to check again give it like 10mins. PM2 is a Real-time Monitoring package it should track any Issues & Exceptions of any nodejs apps registered/saved on it.

Post your node version and npm version here still

still don’t work. node v16.18.1 and npm v8.19.2.

Hello, still don’t work


This person had a similar problem!