无法在Heroku上部署应用程序

时间:2017-08-09 09:36:52

标签: node.js heroku deployment

我正在尝试将应用程序部署到Heroku,但在日志中部署后,我收到以下错误:

2017-08-09T09:32:39.071603+00:00 app[web.1]: 
2017-08-09T09:32:39.876049+00:00 app[web.1]: /app/main.js:38
2017-08-09T09:32:39.876059+00:00 app[web.1]: app.set('port', (process.env.PORT || 5000));
2017-08-09T09:32:39.876060+00:00 app[web.1]:                             ^
2017-08-09T09:32:39.876060+00:00 app[web.1]: 
2017-08-09T09:32:39.876063+00:00 app[web.1]: TypeError: Cannot read property 'PORT' of undefined
2017-08-09T09:32:39.876063+00:00 app[web.1]:     at Object.<anonymous> (/app/main.js:38:29)
2017-08-09T09:32:39.876064+00:00 app[web.1]:     at Module._compile (module.js:570:32)
2017-08-09T09:32:39.876065+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:579:10)
2017-08-09T09:32:39.876065+00:00 app[web.1]:     at Module.load (module.js:487:32)
2017-08-09T09:32:39.876068+00:00 app[web.1]:     at tryModuleLoad (module.js:446:12)
2017-08-09T09:32:39.876069+00:00 app[web.1]:     at Function.Module._load (module.js:438:3)
2017-08-09T09:32:39.876069+00:00 app[web.1]:     at Module.runMain (module.js:604:10)
2017-08-09T09:32:39.876070+00:00 app[web.1]:     at run (bootstrap_node.js:389:7)
2017-08-09T09:32:39.876070+00:00 app[web.1]:     at startup (bootstrap_node.js:149:9)
2017-08-09T09:32:39.876071+00:00 app[web.1]:     at bootstrap_node.js:504:3

当我尝试在本地运行应用程序时出现同样的错误

11:26:03 web.1   |  var port = process.env.PORT || 5000;
11:26:03 web.1   |                        ^
11:26:03 web.1   |  TypeError: Cannot read property 'PORT' of undefined

有人知道我做错了什么吗?

0 个答案:

没有答案