我有一个使用Gulp的Node.js + Angular网络应用。当我运行命令" gulp serve"。
时,它在我的本地机器上完美运行我正在尝试使用我在网上找到的一些资源在Heroku中部署它,所以我做了以下工作。
我已在根目录中使用此内容创建了一个名为 web.js 的新文件:
var gzippo = require('gzippo');
var express = require('express');
var app = express();
app.use(express.logger('dev'));
app.use(gzippo.staticGzip("" + __dirname + "/build"));
app.listen(process.env.PORT || 5000);
我已在根目录中使用此内容创建了一个名为 Procfile 的新文件:
web: node web.js
这是package.json文件。请注意,我已将gulp serve
添加为启动脚本,将bower install
添加为postinstall,因为它是本地工作方式。
{
"name": "myapp",
"version": "0.0.1",
"dependencies": {
"express": "^4.13.3",
"bower": "1.6.5",
"gzippo": "^0.2.0",
},
"scripts": {
"test": "gulp test",
"start": "gulp serve",
"postinstall": "./node_modules/bower/bin/bower install --config.interactive=false && gulp build"
},
"devDependencies": {
"gulp": "~3.9.0",
"gulp-autoprefixer": "~2.3.1",
"gulp-angular-templatecache": "~1.6.0",
"del": "~1.2.0",
"lodash": "~3.9.3",
"gulp-csso": "~1.0.0",
"gulp-filter": "~2.0.2",
"gulp-flatten": "~0.0.4",
"gulp-jshint": "~1.11.0",
"gulp-load-plugins": "~0.10.0",
"gulp-size": "~1.2.1",
"gulp-uglify": "~1.2.0",
"gulp-useref": "~1.2.0",
"gulp-util": "~3.0.5",
"gulp-ng-annotate": "~1.0.0",
"gulp-replace": "~0.5.3",
"gulp-rename": "~1.2.2",
"gulp-rev": "~5.0.0",
"gulp-rev-replace": "~0.4.2",
"gulp-minify-html": "~1.0.3",
"gulp-inject": "~1.3.1",
"gulp-protractor": "~1.0.0",
"gulp-sourcemaps": "~1.5.2",
"gulp-sass": "~2.0.1",
"gulp-angular-filesort": "~1.1.1",
"main-bower-files": "~2.8.0",
"merge-stream": "~0.1.7",
"jshint-stylish": "~2.0.0",
"wiredep": "~2.2.2",
"karma": "~0.12.36",
"karma-jasmine": "~0.3.5",
"karma-phantomjs-launcher": "~0.2.0",
"karma-angular-filesort": "~0.1.0",
"karma-ng-html2js-preprocessor": "~0.1.2",
"concat-stream": "~1.5.0",
"require-dir": "~0.3.0",
"browser-sync": "~2.7.12",
"browser-sync-spa": "~1.0.2",
"http-proxy-middleware": "~0.0.5",
"chalk": "~1.0.0",
"uglify-save-license": "~0.4.1",
"wrench": "~1.5.8"
},
"engines": {
"node": ">=0.10.0"
}
}
我在推送之前运行了这些命令:
heroku config:set NPM_CONFIG_PRODUCTION=false
heroku config:set NODE_ENV=production
我已将buildpack设置为:https://github.com/appstack/heroku-buildpack-nodejs-gulp.git
应用程序正在部署而不会出现错误,包括所有的bower安装过程。日志只显示" app崩溃"。有什么想法吗?
答案 0 :(得分:1)
我遇到了同样的错误,应用程序崩溃了heroku(在开发中运行正常)但是heroku上的错误日志没有透露任何线索。我想也许我可以进入heroku控制台并环顾四周。我做了,甚至控制台崩溃了,但这次它告诉我为什么。这是一个模糊的变量,我忘了在早些时候的故障排除会话中删除。我不是说你会遇到同样的问题,但是当我试图通过控制台时,我发现了更多信息。希望这会有所帮助。