我安装了自耕农,咕噜,凉亭的NodeJs应用程序。我使用yeomen生成了angularjs应用程序。通过键入grunt serve
,本地版本的应用程序运行没有问题。此外,应用程序已成功部署到Heroku grunt deploy
link。当尝试访问heroku上的应用程序时,它显示:
应用程序错误应用程序和页面中发生错误 无法提供服务。请稍后再试。
如果您是应用程序所有者,请查看日志以获取详细信息。
在应用程序日志(Heroku仪表板>活动)中:
部署
构建成功
-----> Node.js app detected
-----> Reading application state
package.json...
build directory...
cache directory...
environment variables...
Node engine: >=0.10.0
Npm engine: unspecified
Start mechanism: Procfile
node_modules source: package.json
node_modules cached: true
NPM_CONFIG_PRODUCTION=true
NODE_MODULES_CACHE=true
-----> Installing binaries
Resolving node version >=0.10.0 via semver.io...
Downloading and installing node 0.10.35...
Using default npm version: 1.4.28
-----> Building dependencies
Restoring node modules from cache
Pruning unused dependencies
npm WARN package.json nodejsw3@0.0.0 No repository field.
Installing any new modules
npm WARN package.json nodejsw3@0.0.0 No repository field.
-----> Checking startup method
Found Procfile
-----> Finalizing build
Creating runtime environment
Exporting binary paths
Cleaning npm artifacts
Cleaning previous cache
Caching results for future builds
-----> Build succeeded!
nodejsw3@0.0.0 /tmp/build_9b26539892553ae79f16e539e2f083e0
????????? (empty)
WARNING: Avoid semver ranges starting with '>' in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
-----> Discovering process types
Procfile declares types -> web
-----> Compressing... done, 6.8MB
-----> Launching... done, v9
https://myapp.herokuapp.com/ deployed to Heroku
项目结构:
日志
2015-02-07T17:49:56.504866+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=myapp.herokuapp.com request_id=257d316d-98
d1-4d21-a170-7c27e42b907e fwd="10.10.10.11" dyno= connect= service= status=503
bytes=
2015-02-07T17:49:57.762152+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=
f109ba40-e921-486a-a79a-7a7d842705a7 fwd="10.10.10.11" dyno= connect= service=
status=503 bytes=
2015-02-07T17:53:40.155437+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=myapp.herokuapp.com request_id=7e0e784c-0e
76-48b1-ad3e-bbf74b400e31 fwd="10.10.10.11" dyno= connect= service= status=503
bytes=
2015-02-07T17:53:41.454002+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=
4d56eacf-5515-48e4-9b5d-34ccc4c4457e fwd="10.10.10.11" dyno= connect= service=
status=503 bytes=
2015-02-07T17:54:20.109125+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=myapp.herokuapp.com request_id=b244e431-81
d6-4f82-a0e0-1e845a45a449 fwd="10.10.10.11" dyno= connect= service= status=503
bytes=
2015-02-07T17:54:21.286203+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/favicon.ico" host=myapp.herokuapp.com request_id=
e2c7d762-a88c-49f6-a15b-e1768e7310d5 fwd="10.10.10.11" dyno= connect= service=
status=503 bytes=
2015-02-07T17:57:14.924093+00:00 heroku[web.1]: State changed from crashed to st
arting
2015-02-07T17:57:16.809601+00:00 heroku[web.1]: Starting process with command `n
ode index.js`
2015-02-07T17:57:18.731681+00:00 app[web.1]: module.js:340
2015-02-07T17:57:18.736235+00:00 app[web.1]: at Function.Module._resolveFile
name (module.js:338:15)
2015-02-07T17:57:18.736237+00:00 app[web.1]: at Function.Module._load (modul
e.js:280:25)
2015-02-07T17:57:18.736241+00:00 app[web.1]: at require (module.js:380:17)
2015-02-07T17:57:18.736243+00:00 app[web.1]: at Object.<anonymous> (/app/ind
ex.js:1:77)
2015-02-07T17:57:18.732015+00:00 app[web.1]: throw err;
2015-02-07T17:57:18.736244+00:00 app[web.1]: at Module._compile (module.js:4
56:26)
2015-02-07T17:57:18.731200+00:00 app[web.1]:
2015-02-07T17:57:18.732021+00:00 app[web.1]: ^
2015-02-07T17:57:18.736232+00:00 app[web.1]: Error: Cannot find module 'express'
2015-02-07T17:57:18.736239+00:00 app[web.1]: at Module.require (module.js:36
4:17)
2015-02-07T17:57:18.736246+00:00 app[web.1]: at Object.Module._extensions..j
s (module.js:474:10)
2015-02-07T17:57:18.736247+00:00 app[web.1]: at Module.load (module.js:356:3
2)
2015-02-07T17:57:18.736249+00:00 app[web.1]: at Function.Module._load (modul
e.js:312:12)
2015-02-07T17:57:18.736251+00:00 app[web.1]: at Function.Module.runMain (mod
ule.js:497:10)
2015-02-07T17:57:19.580364+00:00 heroku[web.1]: Process exited with status 8
2015-02-07T17:57:19.592340+00:00 heroku[web.1]: State changed from starting to c
rashed