Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot find module /srv/server.js - gcloud app engine

The error I get when trying to deploy my service to app engine is:

Error: Cannot find module '/srv/server.js' at 

`Function.Module._resolveFilename (module.js:548:15) at 

Function.Module._load (module.js:475:25) at Function.Module.runMain 

(module.js:694:10) at startup (bootstrap_node.js:204:16) at 

bootstrap_node.js:625:3`

I dont have a /srv/server.js and why would it look for it?!?!?

Thanks if you can help!

like image 563
Sparlarva Avatar asked Mar 24 '19 13:03

Sparlarva


1 Answers

Check your package.json, you should have at least:

"main": "app.js"

where app.js is your node-file which starts the server.

You could also add:

"scripts": {
    "start": "node app.js"
},

and run "yarn start" to test that your server starts ok.

like image 180
Eija Avatar answered Sep 21 '22 14:09

Eija