Node js impossible to start on remote server

Hi
I have a problem with node js on remote server. If I send the project on a remote folder and connecting to ssh and start the server with “npm start” i receive this error:

Instead if I use a sample project “Hello Word” downloaded from the web

const http = require('http');
const port = process.env.PORT || 4000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  const msg = 'Hello Node!\n'
  res.end(msg);
});

server.listen(port, () => {
  console.log(`Server running on http://localhost:${port}/`);
});

all works

hello node

The server hosting require to open the listening port of the app to 4000, so I created a config.json file (as per this guide Node.js - Easy way to change port) but always the same error.

Can someone help me please?
Thanks

Community Page
Last updated: