之前听各位朋友推荐 Mina 来做部署比较方便,最近也正在尝试,但是一路上很坎坷,现在一直卡在这个问题上:
执行mina deploy
之后,
-----> Creating a temporary build path
-----> Fetching new git commits
-----> Using git branch 'basic-login'
Cloning into '.'...
done.
-----> Using this git commit
Shucheng (b415511):
> update gitignore
-----> Symlinking shared paths
-----> Installing gem dependencies using Bundler
Fetching source index from https://rubygems.org/
Using rake (11.2.2)
Using CFPropertyList (2.3.2)
Using concurrent-ruby (1.0.2)
Using i18n (0.7.0)
Using minitest (5.9.0)
Using thread_safe (0.3.5)
Using tzinfo (1.2.2)
Installing activesupport (5.0.0)
Gem::InstallError: activesupport requires Ruby version >= 2.2.2.
An error occurred while installing activesupport (5.0.0), and Bundler cannot
continue.
Make sure that `gem install activesupport -v '5.0.0'` succeeds before bundling.
! ERROR: Deploy failed.
-----> Cleaning up build
Unlinking current
OK
Connection to IP closed.
! Command failed.
Failed with status 1 (4864)
不知道问题到底出在哪里,服务器 Ruby 版本 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux],bundler 版本为:1.12.5,并且gem list
之中是有 activesupport (5.0.0) 的,正常安装的。
已经经过了如下的尝试:重启服务器、重新执行gem install activesupport -v '5.0.0
、本地重新bundle install
并 push、修改服务器 gem 服务器地址均无效。求大家帮忙,谢谢!
解决办法:卸载 rvm 之后,使用 brightbox 安装 ruby,详见 7 楼
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/www/sample_app/shared/bundle/ruby/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20160909-4619-scgbpp.rb extconf.rb
Cannot allocate memory - /usr/bin/ruby2.3 -r ./siteconf20160909-4619-scgbpp.rb extconf.rb 2>&1
Gem files will remain installed in /var/www/sample_app/tmp/build-14733503545042/vendor/bundle/ruby/2.3.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /var/www/sample_app/tmp/build-14733503545042/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.8/gem_make.out
An error occurred while installing nokogiri (1.6.8), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.8'` succeeds before bundling.
! ERROR: Deploy failed.
我同样是执行了 gem install nokogiri -v '1.6.8'之后确认正确安装了,'gem list'之中已经有这个 nokogiri 了,但是仍然无法 deploy,内存占用最高只达到 50% 左右
解决办法:sudo apt-get upgrade && sudo apt-get update
到Fetching source index from https://gems.ruby-china.org/
这一步的时候会卡很久,内存占用到 50% 左右,但是最后的错误是
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /var/www/sample_app/shared/bundle/ruby/2.3.0/gems/pg-0.18.4/ext
/usr/bin/ruby2.3 -r ./siteconf20160913-24390-122b12q.rb extconf.rb
Cannot allocate memory - /usr/bin/ruby2.3 -r ./siteconf20160913-24390-122b12q.rb extconf.rb 2>&1
Gem files will remain installed in /var/www/sample_app/tmp/build-147374600916299/vendor/bundle/ruby/2.3.0/gems/pg-0.18.4 for inspection.
Results logged to /var/www/sample_app/tmp/build-147374600916299/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/pg-0.18.4/gem_make.out
An error occurred while installing pg (0.18.4), and Bundler cannot continue.
Make sure that `gem install pg -v '0.18.4'` succeeds before bundling.
! ERROR: Deploy failed.
是不是问题在 gem 之上,好头疼啊!