Ruby on Rails 3:bundle install使用NoMethodErrors继续失败

时间:2016-05-16 02:23:51

标签: ruby-on-rails rubygems rvm

每当我尝试创建一个新的Rails项目并运行bundle install时,我都会遇到这样的错误:

/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/source.rb:253:in `fetch_all_remote_specs': undefined method `list' for #<Gem::SpecFetcher:0x8da5cc0> (NoMethodError)     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/source.rb:234:in     `block in remote_specs'     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/source.rb:231:in     `each'  from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/source.rb:231:in     `remote_specs'  from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/source.rb:165:in     `fetch_specs'   from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/source.rb:70:in     `specs'  from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/definition.rb:176:in     `block (2 levels) in index'     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in     `each'  from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/definition.rb:175:in     `block in index'    from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/index.rb:7:in     `build'    from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/definition.rb:174:in     `index'     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/definition.rb:168:in     `resolve'   from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/definition.rb:107:in     `specs'     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/definition.rb:102:in     `resolve_remotely!'     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/installer.rb:43:in     `run'     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/installer.rb:8:in     `install'  from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/cli.rb:219:in     `install'  from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/vendor/thor/task.rb:22:in     `run'  from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'   from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/vendor/thor.rb:263:in     `dispatch'     from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/lib/bundler/vendor/thor/base.rb:386:in `start'   from
/.rvm/gems/ruby-1.9.3-p551/gems/bundler-1.0.22/bin/bundle:13:in     `<top (required)>'  from
/.rvm/gems/ruby-1.9.3-p551/bin/bundle:23:in `load'  from
/.rvm/gems/ruby-1.9.3-p551/bin/bundle:23:in `<main>'    from
/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in     `eval'   from
/.rvm/gems/ruby-1.9.3-p551/bin/ruby_executable_hooks:15:in     `<main>'

我已经尝试了很多,包括从我的系统中完全卸载和清除rails,ruby和rvm(甚至删除剩余的文件和对配置文件中的rvm的引用),但它总是在这一步失败。我尝试了从1.0.0到1.6.4的Bundler版本,后者意外地,Ruby 1.9.2,1.9.3和2.1,Rails 3.0.1,3.0.2和3.2.6它所涉及的方法因我的不同而有所不同不同的尝试,但列出的目录始终是相同的。 .rvm位于我的主目录中,出于隐私原因,我将其删除。

我在Bunsenlabs上使用Ruby on Rails 3.0.2和Ruby 1.9.3(文档很便宜。),这是一个debian发行版。我发出以下命令来安装ruby和rails并创建我的项目:

\curl -sSL https://get.rvm.io | bash -s stable --without-gems="rvm rubygems-bundler"
rvm install 1.9.3
rvm reload
rvm --default use 1.9.3
gem install rails --version 3.0.2
rails new railsapp3 -T
cd railsapp3
bundle install

(bundler~&gt; 1.0.0是rails 3.0.2所需的版本)

这是该项目的宝石文件的内容:

  

来源&#39; http://rubygems.org&#39;

     

gem&#39; rails&#39;,&#39; 3.0.2&#39;

     

gem&#39; sqlite3-ruby&#39;,&#39; 1.3.1&#39;,:require =&gt; &#39; sqlite3的&#39;

这种方法在我的旧笔记本电脑上运行顺畅(相同的操作系统)。我怀疑它与不同ruby安装的版本冲突有关,但我上次尝试时彻底清除了它。

如果有人能给我一个如何解决这个问题的提示,我真的很感激!

修改

对于遇到这个问题的任何可怜的灵魂并且偶然发现这个帖子,对这个gemfile进行复制(显然是对于rails 3.1.0),它有效:

ruby on rails 3 tutorial gemfile

0 个答案:

没有答案