我已经使用Heroku平台成功部署了一些简单的nodeJS应用程序。
现在我想使用以下方式部署完整的应用程序:
1)MongoLab托管的MongoDB数据库;
2)前端组件的AngularJS + Bootstrap;
这可以部署到Heroku吗?
如果是这样,我需要对git repo和Procfile进行哪些更改才能使其正常工作?
现在,我的github回购看起来像这样:
这是正确的结构吗?
我知道需要监听:process.env.PORT而不是固定的,我也知道使用npm init自动构建package.json。
出于某种原因,我无法部署,我收到此错误日志:
2015-10-01T08:07:01.099635+00:00 heroku[web.1]: Starting process with command `node server.js`
2015-10-01T08:07:03.847353+00:00 app[web.1]: module.js:338
2015-10-01T08:07:03.847392+00:00 app[web.1]: at Module._compile (module.js:434:26)
2015-10-01T08:07:03.847378+00:00 app[web.1]: throw err;
2015-10-01T08:07:03.847394+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-10-01T08:07:03.847380+00:00 app[web.1]: ^
2015-10-01T08:07:03.847393+00:00 app[web.1]: at Object.Module._extensions..js (module.js:452:10)
2015-10-01T08:07:03.847381+00:00 app[web.1]:
2015-10-01T08:07:03.847396+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-10-01T08:07:03.847383+00:00 app[web.1]: Error: Cannot find module 'xmlbuilder'
2015-10-01T08:07:03.847397+00:00 app[web.1]: at Module.require (module.js:365:17)
2015-10-01T08:07:03.847385+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:336:15)
2015-10-01T08:07:03.847386+00:00 app[web.1]: at Function.Module._load (module.js:286:25)
2015-10-01T08:07:03.847387+00:00 app[web.1]: at Module.require (module.js:365:17)
2015-10-01T08:07:03.847389+00:00 app[web.1]: at require (module.js:384:17)
2015-10-01T08:07:03.847390+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/nodemailer/node_modules/aws-sdk/lib/xml/builder.js:2:15)
2015-10-01T08:07:03.847398+00:00 app[web.1]: at require (module.js:384:17)
2015-10-01T08:07:03.847400+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/nodemailer/node_modules/aws-sdk/lib/core.js:42:14)
2015-10-01T08:07:03.847401+00:00 app[web.1]: at Module._compile (module.js:434:26)
2015-10-01T08:07:03.847402+00:00 app[web.1]: at Object.Module._extensions..js (module.js:452:10)
2015-10-01T08:07:03.847403+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-10-01T08:07:03.847405+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-10-01T08:07:04.829102+00:00 heroku[web.1]: State changed from starting to crashed
2015-10-01T08:07:04.815963+00:00 heroku[web.1]: Process exited with status 1
2015-10-01T08:07:23.430743+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=testeapp8.herokuapp.com request_id=185f6386-0265-494c-8e54-0cc5eec303e5 fwd="81.11.174.99" dyno= connect= service= status=503 bytes=
2015-10-01T08:15:48.636079+00:00 heroku[web.1]: State changed from crashed to starting
2015-10-01T08:15:52.227188+00:00 heroku[web.1]: Starting process with command `node server.js`
2015-10-01T08:15:55.940813+00:00 app[web.1]: module.js:338
2015-10-01T08:15:55.940832+00:00 app[web.1]: throw err;
2015-10-01T08:15:55.940834+00:00 app[web.1]: ^
2015-10-01T08:15:55.940835+00:00 app[web.1]:
2015-10-01T08:15:55.940837+00:00 app[web.1]: Error: Cannot find module 'xmlbuilder'
2015-10-01T08:15:55.940839+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:336:15)
2015-10-01T08:15:55.940840+00:00 app[web.1]: at Function.Module._load (module.js:286:25)
2015-10-01T08:15:55.940841+00:00 app[web.1]: at Module.require (module.js:365:17)
2015-10-01T08:15:55.940843+00:00 app[web.1]: at require (module.js:384:17)
2015-10-01T08:15:55.940844+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/nodemailer/node_modules/aws-sdk/lib/xml/builder.js:2:15)
2015-10-01T08:15:55.940845+00:00 app[web.1]: at Module._compile (module.js:434:26)
2015-10-01T08:15:55.940847+00:00 app[web.1]: at Object.Module._extensions..js (module.js:452:10)
2015-10-01T08:15:55.940848+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-10-01T08:15:55.940849+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-10-01T08:15:55.940850+00:00 app[web.1]: at Module.require (module.js:365:17)
2015-10-01T08:15:55.940852+00:00 app[web.1]: at require (module.js:384:17)
2015-10-01T08:15:55.940853+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/nodemailer/node_modules/aws-sdk/lib/core.js:42:14)
2015-10-01T08:15:55.940854+00:00 app[web.1]: at Module._compile (module.js:434:26)
2015-10-01T08:15:55.940857+00:00 app[web.1]: at Module.load (module.js:355:32)
2015-10-01T08:15:55.940858+00:00 app[web.1]: at Function.Module._load (module.js:310:12)
2015-10-01T08:15:55.940856+00:00 app[web.1]: at Object.Module._extensions..js (module.js:452:10)
2015-10-01T08:15:56.867807+00:00 heroku[web.1]: State changed from starting to crashed
2015-10-01T08:15:56.847462+00:00 heroku[web.1]: Process exited with status 1