我正在尝试部署到Heroku。构建完成,但在尝试访问应用程序的已部署Heroku URL时,我遇到了可怕的应用程序错误页面。为了记录,应用程序在本地工作正常。
heroku日志显示:
2015-01-18T23:52:20.823001+00:00 heroku[api]: Release v2 created by sean1rose@gmail.com
2015-01-18T23:52:20.822954+00:00 heroku[api]: Enable Logplex by sean1rose@gmail.com
2015-01-18T23:54:34.426987+00:00 heroku[api]: Scale to web=1 by sean1rose@gmail.com
2015-01-18T23:54:34.521785+00:00 heroku[api]: Deploy 1289891 by sean1rose@gmail.com
2015-01-18T23:54:34.521867+00:00 heroku[api]: Release v3 created by sean1rose@gmail.com
2015-01-18T23:54:36.381434+00:00 heroku[web.1]: Starting process with command `npm start`
2015-01-18T23:54:38.190134+00:00 app[web.1]:
2015-01-18T23:54:38.190156+00:00 app[web.1]: > node server/app.js
2015-01-18T23:54:38.190154+00:00 app[web.1]: > lost-paws@0.0.0 start /app
2015-01-18T23:54:38.190157+00:00 app[web.1]:
2015-01-18T23:54:38.883490+00:00 app[web.1]: npm ERR! node server/app.js
2015-01-18T23:54:38.883593+00:00 app[web.1]: npm ERR! You can get their info via:
2015-01-18T23:54:38.882060+00:00 app[web.1]: npm ERR! lost-paws@0.0.0 start: `node server/app.js`
2015-01-18T23:54:38.882457+00:00 app[web.1]: npm ERR!
2015-01-18T23:54:38.882300+00:00 app[web.1]: npm ERR! Exit status 8
2015-01-18T23:54:38.882569+00:00 app[web.1]: npm ERR! Failed at the lost-paws@0.0.0 start script.
2015-01-18T23:54:38.883070+00:00 app[web.1]: npm ERR! not with npm itself.
2015-01-18T23:54:38.882965+00:00 app[web.1]: npm ERR! This is most likely a problem with the lost-paws package,
2015-01-18T23:54:38.883703+00:00 app[web.1]: npm ERR! npm owner ls lost-paws
2015-01-18T23:54:38.883167+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-01-18T23:54:38.887400+00:00 app[web.1]: npm ERR!
2015-01-18T23:54:38.861184+00:00 app[web.1]:
2015-01-18T23:54:38.861277+00:00 app[web.1]: module.js:340
2015-01-18T23:54:38.883807+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-01-18T23:54:38.861572+00:00 app[web.1]: throw err;
2015-01-18T23:54:38.884623+00:00 app[web.1]: npm ERR! System Linux 3.13.0-40-generic
2015-01-18T23:54:38.861580+00:00 app[web.1]: ^
2015-01-18T23:54:38.863065+00:00 app[web.1]: Error: Cannot find module 'connect-livereload'
2015-01-18T23:54:38.863067+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:338:15)
2015-01-18T23:54:38.863069+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2015-01-18T23:54:38.863070+00:00 app[web.1]: at Module.require (module.js:364:17)
2015-01-18T23:54:38.863072+00:00 app[web.1]: at require (module.js:380:17)
2015-01-18T23:54:38.863074+00:00 app[web.1]: at module.exports (/app/server/config/express.js:39:13)
2015-01-18T23:54:38.885062+00:00 app[web.1]: npm ERR! node -v v0.10.35
2015-01-18T23:54:38.863076+00:00 app[web.1]: at Object.<anonymous> (/app/server/app.js:28:28)
2015-01-18T23:54:38.885212+00:00 app[web.1]: npm ERR! npm -v 1.4.28
2015-01-18T23:54:38.863079+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2015-01-18T23:54:38.863077+00:00 app[web.1]: at Module._compile (module.js:456:26)
2015-01-18T23:54:38.884792+00:00 app[web.1]: npm ERR! command "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-01-18T23:54:38.884928+00:00 app[web.1]: npm ERR! cwd /app
2015-01-18T23:54:38.887502+00:00 app[web.1]: npm ERR! Additional logging details can be found in:
2015-01-18T23:54:38.863081+00:00 app[web.1]: at Module.load (module.js:356:32)
2015-01-18T23:54:38.863082+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2015-01-18T23:54:38.885344+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2015-01-18T23:54:38.887616+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2015-01-18T23:54:38.875786+00:00 app[web.1]:
2015-01-18T23:54:38.887876+00:00 app[web.1]: npm ERR! not ok code 0
2015-01-18T23:54:39.719402+00:00 heroku[web.1]: Process exited with status 1
2015-01-18T23:54:39.735314+00:00 heroku[web.1]: State changed from starting to crashed
2015-01-18T23:54:39.736471+00:00 heroku[web.1]: State changed from crashed to starting
2015-01-18T23:54:41.638699+00:00 heroku[web.1]: Starting process with command `npm start`
2015-01-18T23:54:44.176575+00:00 app[web.1]:
2015-01-18T23:54:44.176597+00:00 app[web.1]: > lost-paws@0.0.0 start /app
2015-01-18T23:54:44.176600+00:00 app[web.1]: > node server/app.js
2015-01-18T23:54:44.176602+00:00 app[web.1]:
2015-01-18T23:54:44.944454+00:00 app[web.1]:
2015-01-18T23:54:44.944563+00:00 app[web.1]: module.js:340
2015-01-18T23:54:44.944893+00:00 app[web.1]: throw err;
2015-01-18T23:54:44.946523+00:00 app[web.1]: Error: Cannot find module 'connect-livereload'
2015-01-18T23:54:44.946527+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:338:15)
2015-01-18T23:54:44.944904+00:00 app[web.1]: ^
2015-01-18T23:54:44.946529+00:00 app[web.1]: at Function.Module._load (module.js:280:25)
2015-01-18T23:54:44.946530+00:00 app[web.1]: at Module.require (module.js:364:17)
2015-01-18T23:54:44.946534+00:00 app[web.1]: at module.exports (/app/server/config/express.js:39:13)
2015-01-18T23:54:44.946532+00:00 app[web.1]: at require (module.js:380:17)
2015-01-18T23:54:44.946542+00:00 app[web.1]: at Module.load (module.js:356:32)
2015-01-18T23:54:44.946536+00:00 app[web.1]: at Object.<anonymous> (/app/server/app.js:28:28)
2015-01-18T23:54:44.946538+00:00 app[web.1]: at Module._compile (module.js:456:26)
2015-01-18T23:54:44.946540+00:00 app[web.1]: at Object.Module._extensions..js (module.js:474:10)
2015-01-18T23:54:44.971737+00:00 app[web.1]: npm ERR! npm owner ls lost-paws
2015-01-18T23:54:44.971739+00:00 app[web.1]: npm ERR! There is likely additional logging output above.
2015-01-18T23:54:44.946544+00:00 app[web.1]: at Function.Module._load (module.js:312:12)
2015-01-18T23:54:44.961539+00:00 app[web.1]:
2015-01-18T23:54:44.971750+00:00 app[web.1]: npm ERR! code ELIFECYCLE
2015-01-18T23:54:44.971745+00:00 app[web.1]: npm ERR! cwd /app
2015-01-18T23:54:44.973687+00:00 app[web.1]: npm ERR!
2015-01-18T23:54:44.973892+00:00 app[web.1]: npm ERR! Additional logging details can be found in:
2015-01-18T23:54:44.971741+00:00 app[web.1]: npm ERR! System Linux 3.13.0-40-generic
2015-01-18T23:54:44.974056+00:00 app[web.1]: npm ERR! /app/npm-debug.log
2015-01-18T23:54:44.971743+00:00 app[web.1]: npm ERR! command "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2015-01-18T23:54:44.971747+00:00 app[web.1]: npm ERR! node -v v0.10.35
2015-01-18T23:54:44.971749+00:00 app[web.1]: npm ERR! npm -v 1.4.28
2015-01-18T23:54:44.971732+00:00 app[web.1]: npm ERR! node server/app.js
2015-01-18T23:54:44.974317+00:00 app[web.1]: npm ERR! not ok code 0
2015-01-18T23:54:44.971735+00:00 app[web.1]: npm ERR! You can get their info via:
2015-01-18T23:54:44.968692+00:00 app[web.1]: npm ERR! lost-paws@0.0.0 start: `node server/app.js`
2015-01-18T23:54:44.968950+00:00 app[web.1]: npm ERR! Exit status 8
2015-01-18T23:54:44.969100+00:00 app[web.1]: npm ERR!
2015-01-18T23:54:44.969217+00:00 app[web.1]: npm ERR! Failed at the lost-paws@0.0.0 start script.
2015-01-18T23:54:44.969680+00:00 app[web.1]: npm ERR! This is most likely a problem with the lost-paws package,
2015-01-18T23:54:44.969927+00:00 app[web.1]: npm ERR! Tell the author that this fails on your system:
2015-01-18T23:54:44.969818+00:00 app[web.1]: npm ERR! not with npm itself.
2015-01-18T23:54:45.880203+00:00 heroku[web.1]: Process exited with status 1
2015-01-18T23:54:45.897075+00:00 heroku[web.1]: State changed from starting to crashed
2015-01-18T23:55:16.559776+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=glacial-anchorage-9676.herokuapp.com request_id=286bd58c-aec2-459f-aa24-c1eecd29b632 fwd="199.21.87.214" dyno= connect= service= status=503 bytes=
2015-01-18T23:55:18.626486+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=glacial-anchorage-9676.herokuapp.com request_id=497bdc42-1456-4bf3-aa51-64096fc5eb20 fwd="199.21.87.214" dyno= connect= service= status=503 bytes=
我检查了以下错误行:
Error: Cannot find module 'connect-livereload'
所以我尝试 npm安装connect-livereload 无济于事。
我以为我也会分享我的app.js文件:
'use strict';
// Set default node environment to development
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
var express = require('express');
var mongoose = require('mongoose');
var config = require('./config/environment');
// Connect to database
mongoose.connect(config.mongo.uri, config.mongo.options);
// Populate DB with sample data
if(config.seedDB) { require('./config/seed'); }
// Setup server
var app = express();
var server = require('http').createServer(app);
var socketio = require('socket.io')(server, {
serveClient: (config.env === 'production') ? false : true,
path: '/socket.io-client'
});
require('./config/socketio')(socketio);
require('./config/express')(app);
require('./routes')(app);
// Start server
server.listen(config.port, config.ip, function () {
console.log('Express server listening on %d, in %s mode', config.port, app.get('env'));
});
// Expose app
exports = module.exports = app;
不知道还能转向何处。如果有人能指出我正确的方向,我们将不胜感激......
答案 0 :(得分:0)
我使用以下yeoman生成器来构建应用程序:
https://github.com/DaftMonk/generator-angular-fullstack
所以我尝试在该链接上使用heroku部署指令,这导致了一些构建错误,但最终能够按照说明修复这些错误。现在部署工作,所以这不再是一个问题。