Rails 急,求助,warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3

hyz0805 · 2015年06月06日 · 最后由 rei 回复于 2015年06月06日 · 5101 次阅读

有个 rails 工程(redmine2.3),rails3.2 的 启动就报错

启动命令

bundle exec thin start -p 8080 -e production -s 5 -d

错误信息

(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
/var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `require': libruby.so.2.0: cannot open shared object file: No such file or directory - /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/rubyeventmachine.so (LoadError)
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `require'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in `require'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in `load'
    from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in `<main>'

###重点

看上去似乎是有另一个 rails?

然后输入

rails -v

居然也报同样的信息

rails -v
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here

在工程目录下 bundle exec ... 也是报上面的错误。

其他信息:

$ bundle env
Bundler 1.3.5
Ruby 2.0.0 (2013-06-27 patchlevel 247) [x86_64-linux]
Rubygems 2.0.6
GEM_HOME

Bundler settings
  without
    Set for your local app (/var/wtn/.bundle/config): "test:rmagick"
  path
    Set for your local app (/var/wtn/.bundle/config): "vendor/cache"
  disable_shared_gems
    Set for your local app (/var/wtn/.bundle/config): "1"


Gemfile
source 'http://ruby.taobao.org'

gem "rails", "3.2.13"
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem "coderay", "~> 1.0.6"
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
gem "httparty"
gem "thin"

# markdown
# download plugin from https://github.com/alminium/redmine_redcarpet_formatter
# git clone git://github.com/alminium/redmine_redcarpet_formatter.git
# then select 'markdown' in admin settings => text format
gem "redcarpet"

# Optional gem for LDAP authentication
group :ldap do
  gem "net-ldap", "~> 0.3.1"
end

# Optional gem for OpenID authentication
group :openid do
  gem "ruby-openid", "~> 2.1.4", :require => "openid"
  gem "rack-openid"
end

# Optional gem for exporting the gantt to a PNG file, not supported with jruby
#platforms :mri, :mingw do
#  group :rmagick do
    # RMagick 2 supports ruby 1.9
    # RMagick 1 would be fine for ruby 1.8 but Bundler does not support
    # different requirements for the same gem on different platforms
#    gem "rmagick", ">= 2.0.0"
#  end
#end

platforms :jruby do
  # jruby-openssl is bundled with JRuby 1.7.0
  gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERSION < '1.7.0'
  gem "activerecord-jdbc-adapter", "1.2.5"
end

# Include database gems for the adapters found in the database
# configuration file
require 'erb'
require 'yaml'
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
if File.exist?(database_file)
  database_config = YAML::load(ERB.new(IO.read(database_file)).result)
  adapters = database_config.values.map {|c| c['adapter']}.compact.uniq
  if adapters.any?
    adapters.each do |adapter|
      case adapter
      when 'mysql2'
        gem "mysql2", "~> 0.3.11", :platforms => [:mri, :mingw]
        gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
      when 'mysql'
        gem "mysql", "~> 2.8.1", :platforms => [:mri, :mingw]
        gem "activerecord-jdbcmysql-adapter", :platforms => :jruby
      when /postgresql/
        gem "pg", ">= 0.11.0", :platforms => [:mri, :mingw]
        gem "activerecord-jdbcpostgresql-adapter", :platforms => :jruby
      when /sqlite3/
        gem "sqlite3", :platforms => [:mri, :mingw]
        gem "activerecord-jdbcsqlite3-adapter", :platforms => :jruby
      when /sqlserver/
        gem "tiny_tds", "~> 0.5.1", :platforms => [:mri, :mingw]
        gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw]
      else
        warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
      end
    end
  else
    warn("No adapter found in config/database.yml, please configure it first")
  end
else
  warn("Please configure your config/database.yml first")
end

group :development do
  gem "rdoc", ">= 2.4.2"
  gem "yard"
end

group :test do
  gem "shoulda", "~> 3.3.2"
  gem "mocha", "~> 0.13.3"
  gem 'capybara', '~> 2.0.0'
end

local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local")
if File.exists?(local_gemfile)
  puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v`
  instance_eval File.read(local_gemfile)
end

# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
  puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
  instance_eval File.read(file)
end


Gemfile.lock
GEM
  remote: http://ruby.taobao.org/
  remote: https://rubygems.org/
  remote: https://rubygems.org/
  specs:
    ZenTest (4.5.0)
    actionmailer (3.2.13)
      actionpack (= 3.2.13)
      mail (~> 2.5.3)
    actionpack (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      journey (~> 1.0.4)
      rack (~> 1.4.5)
      rack-cache (~> 1.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.2.1)
    activemodel (3.2.13)
      activesupport (= 3.2.13)
      builder (~> 3.0.0)
    activerecord (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
      arel (~> 3.0.2)
      tzinfo (~> 0.3.29)
    activeresource (3.2.13)
      activemodel (= 3.2.13)
      activesupport (= 3.2.13)
    activesupport (3.2.13)
      i18n (= 0.6.1)
      multi_json (~> 1.0)
    arel (3.0.3)
    autotest-rails (4.2.1)
      ZenTest (~> 4.5)
    builder (3.0.0)
    capybara (2.0.3)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 1.0.0)
    childprocess (0.5.3)
      ffi (~> 1.0, >= 1.0.11)
    chronic (0.10.2)
    coderay (1.0.9)
    cucumber (1.3.16)
      builder (>= 2.1.2)
      diff-lcs (>= 1.1.3)
      gherkin (~> 2.12)
      multi_json (>= 1.7.5, < 2.0)
      multi_test (>= 0.1.1)
    cucumber-rails (1.4.1)
      capybara (>= 1.1.2, < 3)
      cucumber (>= 1.3.8, < 2)
      mime-types (~> 1.16)
      nokogiri (~> 1.5)
      rails (>= 3, < 5)
    culerity (0.2.15)
    daemons (1.1.9)
    database_cleaner (1.3.0)
    diff-lcs (1.1.3)
    docile (1.1.5)
    erubis (2.7.0)
    eventmachine (1.0.3)
    fastercsv (1.5.5)
    faye-websocket (0.4.7)
      eventmachine (>= 0.12.0)
    ffi (1.9.3)
    gherkin (2.12.2)
      multi_json (~> 1.3)
    hike (1.2.3)
    holidays (1.0.6)
    http_parser.rb (0.5.3)
    httparty (0.11.0)
      json (~> 1.8)
      multi_xml (>= 0.5.2)
    i18n (0.6.1)
    icalendar (2.1.1)
    inifile (3.0.0)
    journey (1.0.4)
    jquery-rails (2.0.3)
      railties (>= 3.1.0, < 5.0)
      thor (~> 0.14)
    json (1.8.1)
    mail (2.5.4)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    metaclass (0.0.4)
    mime-types (1.25.1)
    mocha (0.13.3)
      metaclass (~> 0.0.1)
    multi_json (1.10.1)
    multi_test (0.1.1)
    multi_xml (0.5.5)
    mysql2 (0.3.16)
    net-ldap (0.3.1)
    nokogiri (1.5.11)
    open-uri-cached (0.0.5)
    pdf-core (0.2.5)
    poltergeist (1.1.2)
      capybara (~> 2.0.1)
      faye-websocket (~> 0.4.4)
      http_parser.rb (~> 0.5.3)
    polyglot (0.3.5)
    prawn (1.2.1)
      pdf-core (~> 0.2.5)
      ttfunk (~> 1.2.0)
    rack (1.4.5)
    rack-cache (1.2)
      rack (>= 0.4)
    rack-openid (1.4.2)
      rack (>= 1.1.0)
      ruby-openid (>= 2.1.8)
    rack-ssl (1.3.4)
      rack
    rack-test (0.6.2)
      rack (>= 1.0)
    rails (3.2.13)
      actionmailer (= 3.2.13)
      actionpack (= 3.2.13)
      activerecord (= 3.2.13)
      activeresource (= 3.2.13)
      activesupport (= 3.2.13)
      bundler (~> 1.0)
      railties (= 3.2.13)
    railties (3.2.13)
      actionpack (= 3.2.13)
      activesupport (= 3.2.13)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (>= 0.14.6, < 2.0)
    rake (10.3.2)
    rdoc (3.12.2)
      json (~> 1.4)
    redcarpet (3.1.2)
    rspec (2.11.0)
      rspec-core (~> 2.11.0)
      rspec-expectations (~> 2.11.0)
      rspec-mocks (~> 2.11.0)
    rspec-core (2.11.1)
    rspec-expectations (2.11.3)
      diff-lcs (~> 1.1.3)
    rspec-mocks (2.11.3)
    rspec-rails (2.11.4)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      railties (>= 3.0)
      rspec (~> 2.11.0)
    ruby-openid (2.1.8)
    ruby-prof (0.15.1)
    rubyzip (1.1.6)
    selenium-webdriver (2.42.0)
      childprocess (>= 0.5.0)
      multi_json (~> 1.0)
      rubyzip (~> 1.0)
      websocket (~> 1.0.4)
    shoulda (3.3.2)
      shoulda-context (~> 1.0.1)
      shoulda-matchers (~> 1.4.1)
    shoulda-context (1.0.2)
    shoulda-matchers (1.4.1)
      activesupport (>= 3.0.0)
    simplecov (0.9.0)
      docile (~> 1.1.0)
      multi_json
      simplecov-html (~> 0.8.0)
    simplecov-html (0.8.0)
    spork (0.9.2)
    sprockets (2.2.2)
      hike (~> 1.2)
      multi_json (~> 1.0)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    thin (1.6.2)
      daemons (>= 1.0.9)
      eventmachine (>= 1.0.0)
      rack (>= 1.0.0)
    thor (0.19.1)
    tilt (1.4.1)
    timecop (0.3.5)
    treetop (1.4.15)
      polyglot
      polyglot (>= 0.3.1)
    ttfunk (1.2.0)
    tzinfo (0.3.41)
    websocket (1.0.7)
    xpath (1.0.0)
      nokogiri (~> 1.3)
    yard (0.8.7.4)

PLATFORMS
  ruby

DEPENDENCIES
  ZenTest (= 4.5.0)
  activerecord-jdbc-adapter (= 1.2.5)
  activerecord-jdbcmysql-adapter
  autotest-rails
  builder (= 3.0.0)
  capybara (~> 2.0.0)
  chronic
  coderay (~> 1.0.6)
  cucumber-rails
  culerity
  database_cleaner
  fastercsv (~> 1.5.0)
  faye-websocket (~> 0.4.7)
  gherkin (~> 2.6)
  holidays (~> 1.0.3)
  httparty
  i18n (~> 0.6.0)
  icalendar
  inifile
  jquery-rails (~> 2.0.2)
  json
  mocha (~> 0.13.3)
  mysql2 (~> 0.3.11)
  net-ldap (~> 0.3.1)
  nokogiri (< 1.6.0)
  open-uri-cached
  poltergeist (~> 1.0)
  prawn
  rack-openid
  rails (= 3.2.13)
  rdoc (>= 2.4.2)
  redcarpet
  rspec (~> 2.11.0)
  rspec-rails (~> 2.11.0)
  ruby-openid (~> 2.1.4)
  ruby-prof
  shoulda (~> 3.3.2)
  simplecov (~> 0.6)
  spork
  thin
  timecop (~> 0.3.5)
  yard

我第一次见 Gemfile 里面用 eval 的。

#1 楼 @rei 能提供一些建议或者帮助么 -。-

这个 Gemfile 太复杂,不确定问题在哪。

warning 来自 instance_eval 执行的外部文件,要分析这两个文件才知道问题。

引发错误的是 No such file or directory - /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/rubyeventmachine.so (LoadError),不确定你是怎么装 eventmachine 的。

这个项目依赖这么复杂,是要部署到各种各样的客户环境?我觉得你问现在的维护者怎么处理比较好。

#1 楼 @rei 我对 ruby 不是很熟,只是在维护公司的 redmine,现在这个应用起不起来了,挺着急的。 我觉得

(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3

这个错误提示很关键,似乎有另一个 rails 实例,但是不清楚如何处理,希望可以获得帮助?

#4 楼 @hyz0805 Warning 是不会起不来的,你要关注 Error。

#3 楼 @rei 维护者刚移交到我这,因为一直都是可以启动的。

最近我再这台机器上做了这些事情,可能导致了这个问题出现 安装 rvm, rvm install ruby 2.2 rvm install ruby 2.0

部署了另一个 rails 项目,但并没有启动它

删除了 rvm

我换另一种方式尝试启动:

[****@v125010146 wtn]$ bundle exec ruby script/rails server webrick -e production
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'
/var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `require': libruby.so.2.0: cannot open shared object file: No such file or directory - /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/rubyeventmachine.so (LoadError)
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:8:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `require'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:7:in `<top (required)>'
    from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /usr/local/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /var/wtn/config/application.rb:7:in `<top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `require'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
    from /var/wtn/vendor/cache/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

#6 楼 @hyz0805

  1. 更换 Ruby 版本之后,gem 都要重装(安装目录变了),特别是需要编译的 gem(不兼容)。
  2. 用 rvm 安装 ruby,删掉 rvm 这些 ruby 就不能正常工作了,因为需要 rvm 设置环境变量。

你现在要用哪个 Ruby?

$ ruby -v ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] #8 楼 @rei

#9 楼 @hyz0805 这是系统的还是 rvm 安装的?

#8 楼 @rei 在删除 rvm 前就报这个错误了,删除 rvm 是在尝试重启应用失败后的操作,因为我觉得有 rvm 安装了 ruby 2.0.0-p643,系统默认也有一个 ruby 2.0.0-p247 可能会有冲突。但是删除 rvm 之后,仍然报告相同的错误

gem uninstall eventmachine 执行后没有任何提示反馈

*****@v125010146 wtn]$ gem uninstall eventmachine
[*****@v125010146 wtn]$ bundle install
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
Using rake (10.3.2)
Using i18n (0.6.1)
Using multi_json (1.10.1)
Using activesupport (3.2.13)
Using builder (3.0.0)
Using activemodel (3.2.13)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.13)
Using mime-types (1.25.1)
Using polyglot (0.3.5)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (3.2.13)
Using arel (3.0.3)
Using tzinfo (0.3.41)
Using activerecord (3.2.13)
Using activeresource (3.2.13)
Using coderay (1.0.9)
Using daemons (1.1.9)
Using eventmachine (1.0.3)
Using holidays (1.0.6)
Using multi_xml (0.5.5)
Using httparty (0.11.0)
Using icalendar (2.1.1)
Using inifile (3.0.0)
Using rack-ssl (1.3.4)
Using json (1.8.1)
Using rdoc (3.12.2)
Using thor (0.19.1)
Using railties (3.2.13)
Using jquery-rails (2.0.3)
Using mysql2 (0.3.16)
Using net-ldap (0.3.1)
Using nokogiri (1.5.11)
Using open-uri-cached (0.0.5)
Using pdf-core (0.2.5)
Using ttfunk (1.2.0)
Using prawn (1.2.1)
Using ruby-openid (2.1.8)
Using rack-openid (1.4.2)
Using bundler (1.3.5)
Using rails (3.2.13)
Using redcarpet (3.1.2)
Using thin (1.6.2)
Using yard (0.8.7.4)
Updating files in vendor/cache
Your bundle is complete!
Gems in the groups test and rmagick were not installed.
It was installed into ./vendor/cache

gem uninstall xxx 正常情况下会给出一些信息反馈的么?比如成功了或失败了

rm vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/ -rf
rm vendor/cache/ruby/2.0.0/specifications/eventmachine-1.0.3.gemspec
bundle install

#18 楼 @rei [**@v125010146 wtn]$ rm vendor/cache/ruby/2.0.0/gems/eventmachine-1.0.3/ -rf [@v125010146 wtn]$ rm vendor/cache/ruby/2.0.0/specifications/eventmachine-1.0.3.gemspec [***@v125010146 wtn]$ bundle install (eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3 (eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here (eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3 (eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here Fetching source index from http://ruby.taobao.org/ Fetching source index from https://rubygems.org/

卡在这里了,可能是被墙

我设置的 sourcr 是淘宝的镜像

Gemfile 的源改成

source 'https://ruby.taobao.org'

#20 楼 @rei [*****@v125010146 wtn]$ source 'https://ruby.taobao.org/' -bash: https://ruby.taobao.org/: No such file or directory

#20 楼 @rei

[*****@v125010146 wtn]$ cat Gemfile source 'http://ruby.taobao.org'

gem "rails", "3.2.13" gem "jquery-rails", "~> 2.0.2" gem "i18n", "~> 0.6.0" gem "coderay", "~> 1.0.6"

#21 楼 @hyz0805 编辑 Gemfile 开头那里。

#20 楼 @rei [*****@v125010146 wtn]$ cat Gemfile.lock GEM remote: http://ruby.taobao.org/ remote: https://rubygems.org/ remote: https://rubygems.org/ specs: ZenTest (4.5.0) actionmailer (3.2.13) actionpack (= 3.2.13) mail (~> 2.5.3) actionpack (3.2.13) activemodel (= 3.2.13)

#23 楼 @rei 开头确实就是 taobao 源

奥,是被 rubygems.org 卡住。

$ gem sources -r https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***

https://ruby.taobao.org
# 确保只有 ruby.taobao.org

然后 bundle

#26 楼 @rei 就是照着 ruby.taobao.org 做的,gem sources -l 也只有 *** CURRENT SOURCES ***

https://ruby.taobao.org/

[*****@v125010146 wtn]$ bundle install
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
(eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3
(eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here
Fetching source index from http://ruby.taobao.org/
Fetching source index from https://rubygems.org/
Could not fetch specs from https://rubygems.org/

我看 Gemfile.lock 里还有这几行

GEM
  remote: http://ruby.taobao.org/
  remote: https://rubygems.org/
  remote: https://rubygems.org/

是不是要删掉

#27 楼 @hyz0805 删看看,我不确定。

#27 楼 @hyz0805 我觉得 Gemfile.local 或者 plugins 里面某个 Gemfile 引用了 https://rubygems.org/,也要删掉才行。

#28 楼 @rei [**@v125010146 wtn]$ sudo vim Gemfile.lock [**@v125010146 wtn]$ bundle install (eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3 (eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here (eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3 (eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here Fetching source index from http://ruby.taobao.org/ Fetching source index from https://rubygems.org/ 似乎还是卡在这里了

#32 楼 @hyz0805 试试,我不确定。Gemfile.lock 不用动。

#33 楼 @rei 改了,似乎有效的。多了一行 ruby.taobao.org $ bundle install (eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3 (eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here (eval):9: warning: already initialized constant Bundler::Dsl::RAILS_VERSION_IS_3 (eval):9: warning: previous definition of RAILS_VERSION_IS_3 was here Fetching source index from http://ruby.taobao.org/ Fetching source index from http://ruby.taobao.org/ Fetching source index from https://rubygems.org/

bundle install 似乎成功了

#33 楼 @rei Your bundle is complete! Gems in the groups test and rmagick were not installed. It was installed into ./vendor/cache [*****@v125010146 wtn]$ sh restart.sh /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:39:in require': libruby.so.2.0: cannot open shared object file: No such file or directory - /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin_parser.so (LoadError) from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/lib/thin.rb:39:in' from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in require' from /var/wtn/vendor/cache/ruby/2.0.0/gems/thin-1.6.2/bin/thin:5:in' from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in load' from /var/wtn/vendor/cache/ruby/2.0.0/bin/thin:23:in

'

#33 楼 @rei warning 没了,但还是报这个错误,我感到挺沮丧,你确实在帮我。似乎这个问题比我们想象的更难解决

#36 楼 @hyz0805 cache 玩坏了,全部重装吧。

rm vendor/cache/ -rf
bundle install

#39 楼 @rei 哈哈,我发誓我再也不在生产环境玩了

#39 楼 @rei 应用成功启动了。 [*****@v125010146 wtn]$ sh restart.sh Starting server on 0.0.0.0:8080 ... Starting server on 0.0.0.0:8081 ... Starting server on 0.0.0.0:8082 ... Starting server on 0.0.0.0:8083 ... Starting server on 0.0.0.0:8084 ...

应该是可以。

谢谢你!真的,我不知道该如何表达我的感谢

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