部署 Deploy 的时候,Gem install 失败(扩展了一个提问)

geektony · 2014年07月11日 · 最后由 huacnlee 回复于 2014年07月15日 · 4357 次阅读

问题

使用 mina deploy 的时候,出现找不到 Gem 的问题

$ mina deploy
-----> Using RVM environment 'ruby-2.1.0@default'
       Using /home/deploy/.rvm/gems/ruby-2.1.0
-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'master'
       Cloning into '.'...
       done.
-----> Using this git commit

       tony (e60b9b8):
       > change sources

-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
       Fetching gem metadata from http://rubygems.org/.........
       Fetching additional metadata from http://rubygems.org/..
       Using rake (10.3.2)
       Using i18n (0.6.11)

       Bundler::GemNotFound: Could not find json-1.8.1.gem for installation
       An error occurred while installing json (1.8.1), and Bundler cannot continue.
       Make sure that `gem install json -v '1.8.1'` succeeds before bundling.
 !     ERROR: Deploy failed.
-----> Cleaning up build
       Unlinking current
       OK

 !     Command failed.
       Failed with status 19

解决方案

方案出处 stackoverflow

  • update rvm

    rvm get head
    
  • 用 rvm 重新安装 ruby 2.1.0

    rvm reinstall 2.1.0 --disable-binary
    

扩展提问

请问,有没有不需要重新 install 的方法,感觉是依赖关系出了问题

当初我在 mina 上用 rbenv 的时候,有个类似的错误 后来 删除 rbenv 的一个 bundler 插件(就是自动在命令前面加 bundle exec 功能的插件)就好了。。

@iBachue 我如何查找是哪个 Gem 或者插件的问题呢

Make sure that gem install json -v '1.8.1' succeeds before bundling.

你先在目标机器上试试安装那个 gem 看能不能成功

@blacktulip 我测试过了,是可以 install 成功的,我一开始以为是网络问题,但测试了 10+ 次都是这个结果

#2 楼 @geektony 类似的方法用在 rvm 上应该是不行的 因为 rvm 的这个功能是自带的。。所以我想说的是 换下 rbenv 试试?

@blacktulip @iBachue 有进展了,但是出现了 502 Bad Gateway 的问题

单开一个gemset

需要 登录 后方可回复, 如果你还没有账号请 注册新账号