当前位置:  开发笔记 > 编程语言 > 正文

在noku上使用Git依赖项和在Heroku上使用Node

如何解决《在noku上使用Git依赖项和在Heroku上使用Node》经验,为你挑选了3个好方法。

我有这个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. (/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!     
          npm ERR! or email it to:
          npm ERR!     
          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)?



1> code ninja..:

仅供参考,如果它在GitHub上你可以指定username/repository和npm将完成其余的工作.

{
    "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": "juggy/jugglingdb"
    , "nodemailer": "0.2.3"
  }
}

另外

指定(git/ git+ssh/ git+http/ git+https)://user@host/repo.giturl之一

完整记录


@betzerra我认为那是`juggy/jugglingdb #master`但不确定

2> Derek Breden..:

我不知道这个包,但我有其他人使用如下语法.在heroku上,使用对tar.gz的http引用

的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": "https://github.com/juggy/jugglingdb/tarball/master"
    , "nodemailer": "0.2.3"
  }
}



3> Chris Leishm..:

问题出在他们的nodejs buildpack中.我已经向Heroku发送了一个拉取请求,但是我不知道他们是否或何时会做出回应.幸运的是,有一个使用自定义buildpack的文档记录不太完整,这将允许您解决该问题.我已经分叉了heroku的nodejs buildpack并修复了问题 - 可在此处获得:

https://github.com/chrisleishman/heroku-buildpack-nodejs/tree/git_fix

要使用它,你最好创建自己的https://github.com/heroku/heroku-buildpack-nodejs的github分支,然后在我的chrisleishman/git_fix分支中合并.例如(分叉后):

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_URLconfig变量添加到heroku应用程序中.例如

heroku config:add BUILDPACK_URL="git://github.com/@YOUR-GITHUB-NAME@/heroku-buildpack-nodejs.git

然后下一次推送到heroku应该使用包含修复的自定义buildpack.


此外,我相信此修复程序现已合并到标准buildpack中,因此不再需要此解决方法.
推荐阅读
臭小子
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有