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

流过昼夜 提交于 2020-01-03 13:38:55

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/55324215/cannot-find-module-srv-server-js-gcloud-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!