【发布时间】:2014-10-11 05:34:48
【问题描述】:
我想知道是否可以运行 grunt-contrib-connect 命令以使用 Heroku 提供静态文件。
我的 Grunt 文件如下所示:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
server: {
options: {
port: process.env.PORT || 5000,
base: 'www',
keepalive: true
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-connect');
// Default task(s).
grunt.registerTask('default', ['connect']);
};
我的 Procfile 看起来像这样:
web: grunt
我的 package.json 看起来像这样:
{
"name": "herokoloco",
"version": "0.1.1",
"scripts": {
"postinstall": "bower install"
},
"dependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-connect": "^0.8.0",
"bower": "~1.3.9"
},
"engines": {
"node": "0.10.x"
}
}
我的文件结构如下:
> node_modules
v www
index.html
bower.json
Gruntfile.js
package.json
Procfile
它使用 Heroku 的“工头启动网络”在本地完美运行,但不适用于 Heroku。我的日志中出现了这个错误:
2014-10-08T21:19:23.620448+00:00 heroku[路由器]: at=error code=H14 desc="没有运行网络进程" method=GET path="/" 主机=屏蔽水域-3266.herokuapp.com request_id=4d669be2-a362-4968-8349-b83b8ad0e2f6 fwd="198.245.95.126" dyno=连接=服务=状态=503字节=
【问题讨论】: