Heroku部署错误
Heroku deployment error
我已成功将我的应用程序推送到 heroku,但是当我 heroku open
我的页面上出现应用程序错误。
查看我能看到的日志
2016-02-06T17:06:42.092148+00:00 heroku[slug-compiler]: Slug compilation started
2016-02-06T17:06:42.092157+00:00 heroku[slug-compiler]: Slug compilation failed:
failed to compile Node.js app
2016-02-06T17:07:00.738280+00:00 heroku[router]: at=info code=H81 desc="Blank ap
p" method=GET path="/" host=pacific-headland-94684.herokuapp.com request_id=9bcd
ba26-7eef-4323-baff-86e4f6cc7c11 fwd="109.175.110.196" dyno= connect= service= s
tatus=502 bytes=
稍后在日志中我也得到
2016-02-09T16:20:30.835195+00:00 heroku[slug-compiler]: Slug compilation finished
2016-02-09T16:20:32.198289+00:00 heroku[web.1]: Starting process with command `n
ode server.js`
2016-02-09T16:20:34.904089+00:00 app[web.1]: throw err;
2016-02-09T16:20:34.904090+00:00 app[web.1]: ^
2016-02-09T16:20:34.904079+00:00 app[web.1]: module.js:338
2016-02-09T16:20:34.904092+00:00 app[web.1]: at Function.Module._load (modul
e.js:278:25)
2016-02-09T16:20:34.904091+00:00 app[web.1]: Error: Cannot find module '/app/ser
ver.js'
2016-02-09T16:20:34.904092+00:00 app[web.1]: at Function.Module._resolveFile
name (module.js:336:15)
2016-02-09T16:20:34.904093+00:00 app[web.1]: at Function.Module.runMain (mod
ule.js:501:10)
2016-02-09T16:20:34.904094+00:00 app[web.1]: at startup (node.js:129:16)
2016-02-09T16:20:34.904094+00:00 app[web.1]: at node.js:814:3
2016-02-09T16:20:35.976063+00:00 heroku[web.1]: Process exited with status 1
2016-02-09T16:20:35.977672+00:00 heroku[web.1]: State changed from starting to c
rashed
如果有人对完整日志感兴趣,这里是link:https://www.dropbox.com/s/8l261wmg99yahzc/heroku_logs.txt?dl=0
我搜索过的所有类似问题通常在将应用程序推送到 heroku 时发生,但正如我所说,我的推送是成功的。
问题是 git 存储库不在 apps 文件夹中(在我的例子中命名为 node),而是在上一级文件夹中(命名为 app,这个文件夹不存在在本地 ) 上,所以当我将它推送到 heroku 上时,procfile 在名为 app 的文件夹而不是根文件夹中搜索 server.js,但找不到任何东西。
检查 GitDesktop 上的路径后,我看到了文件夹结构并在正确的位置重新初始化存储库,推送更改并解决了问题。
我已成功将我的应用程序推送到 heroku,但是当我 heroku open
我的页面上出现应用程序错误。
查看我能看到的日志
2016-02-06T17:06:42.092148+00:00 heroku[slug-compiler]: Slug compilation started
2016-02-06T17:06:42.092157+00:00 heroku[slug-compiler]: Slug compilation failed:
failed to compile Node.js app
2016-02-06T17:07:00.738280+00:00 heroku[router]: at=info code=H81 desc="Blank ap
p" method=GET path="/" host=pacific-headland-94684.herokuapp.com request_id=9bcd
ba26-7eef-4323-baff-86e4f6cc7c11 fwd="109.175.110.196" dyno= connect= service= s
tatus=502 bytes=
稍后在日志中我也得到
2016-02-09T16:20:30.835195+00:00 heroku[slug-compiler]: Slug compilation finished
2016-02-09T16:20:32.198289+00:00 heroku[web.1]: Starting process with command `n
ode server.js`
2016-02-09T16:20:34.904089+00:00 app[web.1]: throw err;
2016-02-09T16:20:34.904090+00:00 app[web.1]: ^
2016-02-09T16:20:34.904079+00:00 app[web.1]: module.js:338
2016-02-09T16:20:34.904092+00:00 app[web.1]: at Function.Module._load (modul
e.js:278:25)
2016-02-09T16:20:34.904091+00:00 app[web.1]: Error: Cannot find module '/app/ser
ver.js'
2016-02-09T16:20:34.904092+00:00 app[web.1]: at Function.Module._resolveFile
name (module.js:336:15)
2016-02-09T16:20:34.904093+00:00 app[web.1]: at Function.Module.runMain (mod
ule.js:501:10)
2016-02-09T16:20:34.904094+00:00 app[web.1]: at startup (node.js:129:16)
2016-02-09T16:20:34.904094+00:00 app[web.1]: at node.js:814:3
2016-02-09T16:20:35.976063+00:00 heroku[web.1]: Process exited with status 1
2016-02-09T16:20:35.977672+00:00 heroku[web.1]: State changed from starting to c
rashed
如果有人对完整日志感兴趣,这里是link:https://www.dropbox.com/s/8l261wmg99yahzc/heroku_logs.txt?dl=0
我搜索过的所有类似问题通常在将应用程序推送到 heroku 时发生,但正如我所说,我的推送是成功的。
问题是 git 存储库不在 apps 文件夹中(在我的例子中命名为 node),而是在上一级文件夹中(命名为 app,这个文件夹不存在在本地 ) 上,所以当我将它推送到 heroku 上时,procfile 在名为 app 的文件夹而不是根文件夹中搜索 server.js,但找不到任何东西。
检查 GitDesktop 上的路径后,我看到了文件夹结构并在正确的位置重新初始化存储库,推送更改并解决了问题。