Ruby/RVM with @global gem - bundle 运行 因 `require' 失败:无法加载此类文件 — bundler (LoadError)

Ruby/RVM with @global gem - bundle run fails with `require': cannot load such file — bundler (LoadError)

我学习linux 1个月。当我尝试执行 Migrating from MySQL to Postgres on Heroku 中的所有步骤时,我遇到了无法处理的错误。

当我尝试从源安装 mysqltopostgres gem 时:

$ git clone https://github.com/maxlapshin/mysql2postgres.git
$ cd mysql2postgres
$ bundle install
$ gem build mysqltopostgres.gemspec
$ sudo gem install mysqltopostgres-0.2.20.gem

我在 $ bundle install 上有一个错误:

/home/franchb/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/
kernel_require.rb:55:in `require': cannot load such file -- bundler (LoadError) 
from /home/franchb/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/
kernel_require.rb:55:in `require'
from /usr/bin/bundle:7:in `<main>'

我已经安装了 sudo apt-get install bundler,但是当我尝试输入 bundle -v 时,我得到了同样的错误!

我的gem env是:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: /home/franchb/.rvm/gems/ruby-2.3.0@global
  - USER INSTALLATION DIRECTORY: /home/franchb/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /home/franchb/.rvm/rubies/ruby-2.3.0/bin/ruby
  - EXECUTABLE DIRECTORY: /home/franchb/.rvm/gems/ruby-2.3.0@global/bin
  - SPEC CACHE DIRECTORY: /home/franchb/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /home/franchb/.rvm/rubies/ruby-2.3.0/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /home/franchb/.rvm/gems/ruby-2.3.0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /home/franchb/.rvm/gems/ruby-2.3.0@global/bin
     - /home/franchb/.rvm/rubies/ruby-2.3.0/bin
     - /home/franchb/.rvm/bin
     - /home/franchb/bin
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games

我的rvm gemset list

gemsets for ruby-2.3.0 (found in /home/franchb/.rvm/gems/ruby-2.3.0)
   (default)
=> global
   rails230

我的gem列表是

*** LOCAL GEMS ***

bigdecimal (1.2.8)
bundler-unload (1.0.2)
did_you_mean (1.0.0)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
io-console (0.4.5)
json (1.8.3)
minitest (5.8.3)
net-telnet (0.1.1)
power_assert (0.2.6)
psych (2.0.17)
rake (10.4.2)
rdoc (4.2.1)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (3.1.5)

我用的是LinuxMint 17.3

请帮助我了解问题所在。我需要安装 mysqltopostgres 以将 MySQL 迁移到 Heroku 中的 Posgres。

谢谢!

1) 只跳过 sudo 运行 gem install bundler

2) 运行 bundle install

现在应该可以了