您好,我将我的Ruby on Rails开发平台从Windows7切换到Linux (Debian),我将整个应用程序目录复制到Linux并运行bundle install,命令成功。然后我运行rake db:migrate,它退出并返回以下错误:
`mri_21` is not a valid platform. The available options are: [:ruby, :ruby_18, :ruby_19, :mri, :mri_18, :mri_19, :rbx, :jruby, :mswin, :mingw, :mingw_18, :mingw_19]然后我在谷歌上搜索错误并找到this,我遵循了建议的步骤,即:
gem update bundler上面的命令输出:
Updating installed gems
Nothing to updateThan:bundle install,这也是成功的。但在rake db:migrate上仍然收到相同的错误
我的ruby版本:ruby 1.9.3p194无法通过rails -v获取rails版本,得到相同的mri_21错误,但在我的应用程序的Gemfile中,我有gem 'rails', '4.1.5'
编辑:但当我尝试bundle exec rake db:migrate时,它是成功的。然后我成功地运行了bundle exec rails s和应用程序:
=> Booting Thin
=> Rails 4.1.5 application starting in development on 0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
>> Thin web server (v1.3.1 codename Triple Espresso)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:3000, CTRL+C to stop现在我的问题是,如何每次都摆脱这个bundle exec,以及这是怎么回事。
发布于 2014-12-23 16:33:29
由于bundle exec只修复了PATH和GEM_PATH变量,因此您应该在PATH变量中包含指定给错误版本的rails和gem之前的所有gem二进制文件。还要正确设置GEM_PATH。这样就可以避免bundle exec调用。您可以通过调用了解的所有值:
$ bundle exec echo GEM_HOME=$GEM_HOME\; GEM_PATH=$GEM_PATH\; PATH=$PATH
GEM_HOME=/home/malo/.rvm/gems/ruby-2.1.4; GEM_PATH=/home/malo/.rvm/gems/ruby-2.1.4:/home/malo/.rvm/gems/ruby-2.1.4@global; PATH=/home/malo/.rvm/gems/ruby-2.1.4/bin:/home/malo/.rvm/gems/ruby-2.1.4@global/bin:/home/malo/.rvm/rubies/ruby-2.1.4/bin:/home/malo/.rvm/bin:/usr/local/heroku/bin:/home/malo/.rbenv/bin:/home/malo/bin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:/usr/games:/usr/lib/qt4/binhttps://stackoverflow.com/questions/27616126
复制相似问题