Rails命令给出错误

时间:2016-05-08 19:31:18

标签: ruby-on-rails

当我跑步时,我遇到了一个非常奇怪的错误:-v'命令在我的终端(Mac El Capitan)上显示错误:

/Users/paras/.rvm/gems/ruby-2.3.0/bin/rails:22:in `<main>': undefined method `activate_bin_path' for Gem:Module (NoMethodError)
from /Users/paras/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/paras/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Parass-MacBook-Pro:hackathon_1 paras$ rails -v
/Users/paras/.rvm/gems/ruby-2.3.0/bin/rails:22:in `<main>': undefined method `activate_bin_path' for Gem:Module (NoMethodError)
from /Users/paras/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/paras/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

以及我跑步时的情况。&#39;重新安装rails后,我得到以下内容:

== 20160404103035 CreateEvents: migrating =====================================
-- create_table(:events) rake aborted! 
StandardError: An error has occurred, this and all later migrations canceled:
 PG::UndefinedTable: ERROR: relation "users" does not exist : 
ALTER TABLE "events" ADD CONSTRAINT "fk_rails_0cb5590091" FOREIGN KEY ("user_id") /Users/paras/.rvm/gems/ruby-2.3.0@hackathon_1/gems/activerecord-4.2.5/lib/active‌​_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec' 

以及更多如上所述的不同消息。

请帮帮我。

1 个答案:

答案 0 :(得分:2)

看起来这可能是Rubygems 2.6.2和Ruby 2.3.0的问题。请参阅https://github.com/bundler/bundler/issues/4381https://github.com/bundler/bundler/issues/4402

通过gem update --system 2.6.1使用Rubygems 2.6.1并重新安装Rails gem可能会为您解决问题。