Rails使用旧的(现在不存在的)RVM gem目录

时间:2015-07-12 04:57:39

标签: ruby-on-rails ruby

我正在尝试在Ubuntu 14.04(使用Puma)上运行Rails应用程序。我尝试使用RVM并遇到问题,所以我现在正在尝试使用rbenv。

这一切似乎都奏效了。例如,我可以看到安装了Rails;

IMAGE ID

然而,当我执行时;

crags@CRAGS-SERVER:~/crags$ which rails
/home/crags/.rbenv/shims/rails

rails c

我收到以下错误;

bundle exec rails c

您会注意到Rails仍在尝试使用(现在不存在的)RVM目录。

我用

删除了所有RVM的痕迹
crags@CRAGS-SERVER:~/crags$ bundle exec rails c
/home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- rails/commands (LoadError)
from /home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
from /home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
from /home/crags/crags/bin/rails:8:in `<top (required)>'
from /home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `block in load'
from /home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
from /home/crags/.rvm/gems/ruby-2.1.2/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:268:in `load'
from /home/crags/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/crags/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'

另外,我在PATH中删除了所有.rvm目录和对RVM的引用。

非常感谢任何帮助。 :)

1 个答案:

答案 0 :(得分:1)

对不起大家 - 误报。根据@Paven的请求,我从

得到这个

gem env

输出

crags@CRAGS-SERVER:~/crags$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 2.1.2 (2014-05-08 patchlevel 95) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/crags/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0
- RUBY EXECUTABLE: /home/crags/.rbenv/versions/2.1.2/bin/ruby
- EXECUTABLE DIRECTORY: /home/crags/.rbenv/versions/2.1.2/bin
- SPEC CACHE DIRECTORY: /home/crags/.gem/specs
- RUBYGEMS PLATFORMS:
  - ruby
  - x86_64-linux
- GEM PATHS:
   - /home/crags/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0
   - /home/crags/.gem/ruby/2.1.0
- GEM CONFIGURATION:
   - :update_sources => true
   - :verbose => true
   - :backtrace => false
   - :bulk_threshold => 1000
- REMOTE SOURCES:
   - https://rubygems.org/
- SHELL PATH:
   - /home/crags/.rbenv/versions/2.1.2/bin
   - /home/crags/.rbenv/libexec
   - /home/crags/.rbenv/plugins/ruby-build/bin
   - /home/crags/.rbenv/shims
   - /home/crags/.rbenv/bin
   - /usr/local/sbin
   - /usr/local/bin
   - /usr/sbin
   - /usr/bin
   - /sbin
   - /bin
   - /usr/games
   - /usr/local/games

一个简单的shell注销/登录修复它。我一定有一些陈旧的配置。

对此感到抱歉!