我有一個使用Gulp的Node.js + Angular web應用程序。當我運行命令「gulp serve」時,它在我的本地機器中完美工作。在Heroku上部署Angul應用程序:應用程序崩潰
我試圖在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
這款應用程序部署沒有錯誤,包括所有的涼亭安裝過程。日誌只顯示「應用程序崩潰」。有任何想法嗎?
嘿你找到一個解決方案,我面臨同樣的問題,因爲三週 –