【发布时间】:2017-03-10 18:11:24
【问题描述】:
我向 Heroku 部署了一个使用 gulp 的 NodeJS 应用程序,但它无法在 Heroku 上运行。
这里是package.json:
{
"name": "app-name",
"version": "1.0.0",
"previewUrl": "http://blahblah.com",
"publishUrl": "gs://blahblah.com",
"description": "",
"repository": {
"type": "git",
"url": "git://github.com/github_username/git_repo.git"
},
"devDependencies": {
"browser-sync": "*",
"browserify": "*",
"gulp": "*",
"gulp-autoprefixer": "*",
"gulp-changed": "*",
"gulp-filesize": "*",
"gulp-imagemin": "*",
"gulp-minify-css": "*",
"gulp-notify": "*",
"gulp-rev-all": "*",
"gulp-sass": "*",
"gulp-sourcemaps": "*",
"gulp-uglify": "*",
"gulp-util": "*",
"lodash": "*",
"pretty-hrtime": "*",
"require-dir": "*",
"velocity-animate": "^1.2.2",
"vinyl-source-stream": "*",
"watchify": "*"
},
"dependencies": {
"underscore": "~1.7.0",
"jquery": "~2.1.0",
"keen-js": "~3.2.4",
"superagent": "~1.2.0"
}
}
这里是gulpfile.js:
var requireDir = require('require-dir');
// Require all tasks in gulp/tasks, including subfolders
requireDir('./gulp/tasks', { recurse: true });
这里是Procfile:
`web: gulp`
当我部署到 Heroku 并转到托管应用程序的站点时,我收到“应用程序失败”错误。当我检查我的 Heroku 日志时,我看到了以下内容:
2016-10-27T22:20:10.439111+00:00 heroku[web.1]: Starting process with command `gulp`
2016-10-27T22:20:12.282952+00:00 app[web.1]: bash: gulp: command not found
2016-10-27T22:20:12.376610+00:00 heroku[web.1]: Process exited with status 127
2016-10-27T22:20:12.371981+00:00 heroku[web.1]: State changed from starting to crashed
2016-10-27T22:20:12.373134+00:00 heroku[web.1]: State changed from crashed to starting
2016-10-27T22:20:14.527034+00:00 heroku[web.1]: Starting process with command `gulp`
为什么应用会这样做?
【问题讨论】: