我有这个package.json文件:
{
"name": "application-name"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"coffee-script": "1.1.3"
, "express": "2.5.0"
, "less": "1.1.5"
, "jade": "0.17.0"
, "connect-redis": "1.2.0"
, "hiredis": "0.1.13"
, "redis": "0.7.1"
, "bcrypt": "0.4.1"
, "promised-io": "0.3.0"
, "jugglingdb": "git://github.com/juggy/jugglingdb.git#master"
, "nodemailer": "0.2.3"
}
}
我想部署到Heroku。它在npm 1.0.105版本中可以在本地正常工作,但在Heroku上却令人窒息(我也在那里将npm更新为1.0.105):
-----> Heroku receiving push
-----> Fetching custom build pack... done
-----> Node.js app detected
-----> Fetching Node.js binaries
-----> Vendoring node 0.4.7
-----> Installing dependencies with npm 1.0.105
npm ERR! git checkout master fatal: Not a git repository: '.'
npm ERR! Error: `git "checkout" "master"` failed with 128
npm ERR! at ChildProcess.<anonymous> (/tmp/node-npm-Jb2d/lib/utils/exec.js:49:20)
npm ERR! at ChildProcess.emit (events.js:67:17)
npm ERR! at ChildProcess.onexit (child_process.js:192:12)
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR!
npm ERR! System Linux 2.6.32-316-ec2
npm ERR! command "/tmp/node-node-C3jD/bin/node" "/tmp/node-npm-Jb2d/cli.js" "install"
npm ERR! cwd /tmp/build_2yzg7lk83o5m9
npm ERR! node -v v0.4.7
npm ERR! npm -v 1.0.105
npm ERR! git checkout master fatal: Not a git repository: '.'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /tmp/build_2yzg7lk83o5m9/npm-debug.log
npm not ok
! Failed to install dependencies with npm
! Heroku push rejected, failed to compile Node.js app
另外,我似乎也找不到在/ tmp中访问该日志文件的方法。
有人成功在Heroku上部署了Git依赖项(在ruby方面:P很好)?
最佳答案
问题出在他们的nodejs buildpack中。我已将修复请求发送给Heroku,但我不知道他们是否或何时响应。幸运的是,有一种使用自定义buildpack的方法记录得不是很好,它可以使您解决此问题。我已经 fork 了Heroku的nodejs buildpack并解决了这个问题-在这里可用:
https://github.com/chrisleishman/heroku-buildpack-nodejs/tree/git_fix
要使用此功能,最好是创建自己的https://github.com/heroku/heroku-buildpack-nodejs的github分支,然后合并到我的chrisleishman/git_fix
分支中。例如。 ( fork 后):
git clone git@github.com:@YOUR-GITHUB-NAME@/heroku-buildpack-nodejs.git
cd heroku-buildpack-nodejs
git remote add chrisleishman git://github.com/chrisleishman/heroku-buildpack-nodejs.git
git fetch chrisleishman
git merge chrisleishman/git_fix
git push
然后,您可以将
BUILDPACK_URL
配置变量添加到您的heroku应用程序中。例如。heroku config:add BUILDPACK_URL="git://github.com/@YOUR-GITHUB-NAME@/heroku-buildpack-nodejs.git
然后,对heroku的下一次推送应使用包含修复程序的自定义buildpack。