代码之家  ›  专栏  ›  技术社区  ›  Ved

gemfile.lock未签入-heroku

  •  22
  • Ved  · 技术社区  · 15 年前

    在尝试“Git Push Heroku Master”时,我一直得到错误:

    Counting objects: 266, done.
    Delta compression using up to 4 threads.
    Compressing objects: 100% (239/239), done.
    Writing objects: 100% (266/266), 222.68 KiB, done.
    Total 266 (delta 55), reused 0 (delta 0)
    
    -----> Heroku receiving push
    -----> Rails app detected
    -----> Detected Rails is not set to serve static_assets
           Installing rails3_serve_static_assets... done
    -----> Gemfile detected, running Bundler version 1.0.3
           Unresolved dependencies detected; Installing...
           Using --without development:test
           You have modified your Gemfile in development but did not check
           the resulting snapshot (Gemfile.lock) into version control
    
           You have deleted from the Gemfile:
           * version: 1.0.6
           FAILED: http://docs.heroku.com/bundler
     !     Heroku push rejected, failed to install gems via Bundler
    
    error: hooks/pre-receive exited with error code 1
    To git@heroku.com:freezing-frost-65.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'git@heroku.com:freezing-frost-65.git'
    

    我试图将gemfile和gemfile.lock添加到git中,但没有用。我尝试删除.bundle目录和gemfile.lock,但错误相同。

    6 回复  |  直到 13 年前
        1
  •  15
  •   Aditya Sanghi    15 年前

    Bundler 1.0.6版有问题 您需要在开发机器上运行“gem update bundler”,将bundler更新到1.0.7。然后,您需要在应用程序中运行bundle update来生成一个新的gemfile.lock文件。您将看到gemfile.lock已更新。提交这个新的gemfile.lock并再次推到heroku。

        2
  •  8
  •   jeremy wentworth    15 年前

    我通过打开gemfile.lock并删除以下两行来修复我的问题:

    PLATFORMS
      x86-mingw32
    

    所以现在我只需要制作一个捆绑的脚本,然后将其从锁文件中删除。

        3
  •  6
  •   Simone Carletti    15 年前

    两者都是 Gemfile 和 Gemfile.lock 文件需要包含在Git存储库中。 确保在 .gitignore 文件。

    此外,请确保在本地计算机上使用bundler>=1.0.0生成 gemfile.lock文件 . 如果你使用一个过时的版本,比如bundler 0.9x,它将失败。

    最后,如果您有gemfile.lock,请更新它。

    $ cd /path/to/project
    $ bundle update
    
        4
  •  5
  •   Ved    15 年前
        5
  •  3
  •   Rob Whelan    14 年前

    我删除了gemfile.lock文件平台下的“mingw”行,添加并提交给git,将其推到git,然后将所有内容推到heroku,显然它现在可以工作了。

        6
  •  0
  •   Artemix    13 年前

    在您的应用程序目录中,在 bin 子目录修改文件

    bin/bundle 
    bin/rails 
    bin/rake 
    

    而不是

    '#!/usr/bin/env ruby.exe
    

    必须是

    '#!/usr/bin/env ruby
    

    (感谢上一篇文章)

    确保gemfile.lock中没有对windows的引用-它们可以被删除。

    然后

    git push heroku master
    

    如果仍然有问题,使用 heroku logs (将文本复制到文本编辑器使解决方案的剪切和粘贴更加容易)。