Node js impossible to start on remote server

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'

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?

I encountered a similar error and the solution for me was to change the start code in package.json as below:

Instead of the default ./index.js, writing node index.js seemed to work.
I don’t completely get how the server side stuff works, so might not work for you.

thanks sid it works.