如何找出heroku怎么了?

时间:2019-12-08 19:03:48

标签: node.js heroku

我创建了一个非常简单的nodejs应用程序,链接位于https://bitbucket.org/danclaudiu95/mongo-nodejs-0.git

我只有一个index.js文件

router.get('/', (req, res) => {
    res.send('Hello World')
})

并将更改提交并推送到heroku,该应用程序位于https://git.heroku.com/nodejs-mongo-cc.git,它告诉我“不允许使用方法” 这里https://nodejs-mongo-cc.herokuapp.com/是电话应用程序错误 我在运行heroku日志时收到此日志--tail我有此日志

2019-12-08T18:55:25.296312+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-12-08T18:55:25.296314+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-12-08T18:55:25.296316+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2019-12-08T18:55:25.296318+00:00 app[web.1]: }
2019-12-08T18:55:25.304642+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-12-08T18:55:25.305127+00:00 app[web.1]: npm ERR! errno 1
2019-12-08T18:55:25.306936+00:00 app[web.1]: npm ERR! mongo-nodejs-0@1.0.0 start: `node server.js`
2019-12-08T18:55:25.307220+00:00 app[web.1]: npm ERR! Exit status 1
2019-12-08T18:55:25.307516+00:00 app[web.1]: npm ERR!
2019-12-08T18:55:25.307771+00:00 app[web.1]: npm ERR! Failed at the mongo-nodejs-0@1.0.0 start script.
2019-12-08T18:55:25.308011+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-12-08T18:55:25.316870+00:00 app[web.1]: 
2019-12-08T18:55:25.317055+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-12-08T18:55:25.317209+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-12-08T18_55_25_308Z-debug.log
2019-12-08T18:55:25.382554+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-08T18:55:25.387301+00:00 heroku[web.1]: State changed from crashed to starting
2019-12-08T18:55:25.361045+00:00 heroku[web.1]: Process exited with status 1
2019-12-08T18:55:26.985866+00:00 heroku[web.1]: Starting process with command `npm start`
2019-12-08T18:55:28.903449+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-08T18:55:28.773773+00:00 app[web.1]: 
2019-12-08T18:55:28.773792+00:00 app[web.1]: > mongo-nodejs-0@1.0.0 start /app
2019-12-08T18:55:28.773795+00:00 app[web.1]: > node server.js
2019-12-08T18:55:28.773797+00:00 app[web.1]: 
2019-12-08T18:55:28.821433+00:00 app[web.1]: internal/modules/cjs/loader.js:800
2019-12-08T18:55:28.821437+00:00 app[web.1]: throw err;
2019-12-08T18:55:28.821443+00:00 app[web.1]: ^
2019-12-08T18:55:28.821445+00:00 app[web.1]: 
2019-12-08T18:55:28.821447+00:00 app[web.1]: Error: Cannot find module 'express'
2019-12-08T18:55:28.821449+00:00 app[web.1]: Require stack:
2019-12-08T18:55:28.821451+00:00 app[web.1]: - /app/server.js
2019-12-08T18:55:28.821452+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
2019-12-08T18:55:28.821454+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:690:27)
2019-12-08T18:55:28.821456+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:852:19)
2019-12-08T18:55:28.821457+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2019-12-08T18:55:28.821459+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:17)
2019-12-08T18:55:28.821460+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:959:30)
2019-12-08T18:55:28.821462+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2019-12-08T18:55:28.821463+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:815:32)
2019-12-08T18:55:28.821465+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:727:14)
2019-12-08T18:55:28.821467+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-12-08T18:55:28.821468+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-12-08T18:55:28.821470+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2019-12-08T18:55:28.821471+00:00 app[web.1]: }
2019-12-08T18:55:28.827415+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-12-08T18:55:28.827775+00:00 app[web.1]: npm ERR! errno 1
2019-12-08T18:55:28.828849+00:00 app[web.1]: npm ERR! mongo-nodejs-0@1.0.0 start: `node server.js`
2019-12-08T18:55:28.829049+00:00 app[web.1]: npm ERR! Exit status 1
2019-12-08T18:55:28.829213+00:00 app[web.1]: npm ERR!
2019-12-08T18:55:28.829353+00:00 app[web.1]: npm ERR! Failed at the mongo-nodejs-0@1.0.0 start script.
2019-12-08T18:55:28.829473+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-12-08T18:55:28.836399+00:00 app[web.1]: 
2019-12-08T18:55:28.836520+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-12-08T18:55:28.836621+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-12-08T18_55_28_830Z-debug.log
2019-12-08T18:55:28.884330+00:00 heroku[web.1]: Process exited with status 1
2019-12-08T18:56:13.485700+00:00 app[api]: Release v4 created by user dan_tomuta@yahoo.com
2019-12-08T18:56:13.485700+00:00 app[api]: Set DATABASE_URL config vars by user dan_tomuta@yahoo.com
2019-12-08T18:56:14.534382+00:00 heroku[web.1]: State changed from crashed to starting
2019-12-08T18:56:16.302004+00:00 heroku[web.1]: Starting process with command `npm start`
2019-12-08T18:56:20.368258+00:00 heroku[web.1]: State changed from starting to crashed
2019-12-08T18:56:20.348173+00:00 heroku[web.1]: Process exited with status 1
2019-12-08T18:56:20.213878+00:00 app[web.1]: 
2019-12-08T18:56:20.213966+00:00 app[web.1]: > mongo-nodejs-0@1.0.0 start /app
2019-12-08T18:56:20.213969+00:00 app[web.1]: > node server.js
2019-12-08T18:56:20.213972+00:00 app[web.1]: 
2019-12-08T18:56:20.279308+00:00 app[web.1]: internal/modules/cjs/loader.js:800
2019-12-08T18:56:20.279312+00:00 app[web.1]: throw err;
2019-12-08T18:56:20.279314+00:00 app[web.1]: ^
2019-12-08T18:56:20.279316+00:00 app[web.1]: 
2019-12-08T18:56:20.279318+00:00 app[web.1]: Error: Cannot find module 'express'
2019-12-08T18:56:20.279320+00:00 app[web.1]: Require stack:
2019-12-08T18:56:20.279326+00:00 app[web.1]: - /app/server.js
2019-12-08T18:56:20.279344+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
2019-12-08T18:56:20.279346+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:690:27)
2019-12-08T18:56:20.279349+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:852:19)
2019-12-08T18:56:20.279352+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:74:18)
2019-12-08T18:56:20.279354+00:00 app[web.1]: at Object.<anonymous> (/app/server.js:1:17)
2019-12-08T18:56:20.279356+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:959:30)
2019-12-08T18:56:20.279359+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
2019-12-08T18:56:20.279361+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:815:32)
2019-12-08T18:56:20.279363+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:727:14)
2019-12-08T18:56:20.279365+00:00 app[web.1]: at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10) {
2019-12-08T18:56:20.279367+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2019-12-08T18:56:20.279369+00:00 app[web.1]: requireStack: [ '/app/server.js' ]
2019-12-08T18:56:20.279371+00:00 app[web.1]: }
2019-12-08T18:56:20.284895+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2019-12-08T18:56:20.285175+00:00 app[web.1]: npm ERR! errno 1
2019-12-08T18:56:20.286349+00:00 app[web.1]: npm ERR! mongo-nodejs-0@1.0.0 start: `node server.js`
2019-12-08T18:56:20.286533+00:00 app[web.1]: npm ERR! Exit status 1
2019-12-08T18:56:20.286713+00:00 app[web.1]: npm ERR!
2019-12-08T18:56:20.286852+00:00 app[web.1]: npm ERR! Failed at the mongo-nodejs-0@1.0.0 start script.
2019-12-08T18:56:20.287001+00:00 app[web.1]: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2019-12-08T18:56:20.293863+00:00 app[web.1]: 
2019-12-08T18:56:20.294005+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2019-12-08T18:56:20.294099+00:00 app[web.1]: npm ERR!     /app/.npm/_logs/2019-12-08T18_56_20_287Z-debug.log
2019-12-08T18:59:25.447421+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nodejs-mongo-cc.herokuapp.com request_id=78ed9049-8e85-459d-9579-6a64cdf4a09a fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:26.012326+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nodejs-mongo-cc.herokuapp.com request_id=9f49a46a-ecef-43c3-9f14-e9143c147a5d fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:26.700786+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nodejs-mongo-cc.herokuapp.com request_id=b623338f-0d3d-4ec9-8fa5-6947eaa8ca89 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:27.151441+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nodejs-mongo-cc.herokuapp.com request_id=25967892-0116-4f11-b1e4-fbd051814247 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:28.370508+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nodejs-mongo-cc.herokuapp.com request_id=5627ecd7-98ef-45a1-8475-3b4dfdd91893 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https
2019-12-08T18:59:28.869557+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nodejs-mongo-cc.herokuapp.com request_id=0afb7f92-58ad-4496-84bc-40fc47ebf3b9 fwd="178.138.96.80" dyno= connect= service= status=503 bytes= protocol=https

请问有人可以帮我吗?

1 个答案:

答案 0 :(得分:0)

确保您遵循Heroku网站上的node.js指南。您可以在这里找到它-Getting Started on Heroku with Node.js。确保在项目中添加名称为Procfile的文件,然后键入-web: node index.js。 并且也不要忘记在js文件-app.listen(process.env.PORT);中有一个侦听器。 将文件从git推送到Heroku后,请访问Heroku网站并登录,您将看到您的应用已发布(可能需要花一些时间才能构建)。