rails generate controller失败,“忽略binding_of_caller-0.7.2,因为它的扩展没有构建。”

时间:2016-02-21 01:34:56

标签: ruby-on-rails

当我在新创建的rails应用程序中运行rails generate controller welcome index时,我得到以下答案

Ignoring nokogiri-1.6.6.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.6.2
Ignoring json-1.8.2 because its extensions are not built.  Try: gem pristine json --version 1.8.2
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2

但是没有生成控制器文件。
运行gem pristine --all会得到以下结果:

Restoring gems to pristine condition...
Skipped bigdecimal-1.2.6, it is a default gem
Restored bundler-1.11.2
Restored bundler-1.10.6
Building native extensions.  This could take a while...
Restored curb-0.9.1
Skipped io-console-0.4.3, it is a default gem
Skipped json-1.8.1, it is a default gem
Restored minitest-5.4.3
Restored power_assert-0.2.2
Skipped psych-2.0.8, it is a default gem
Skipped rake-10.4.2, it is a default gem
Skipped rdoc-4.2.0, it is a default gem
Restored test-unit-3.0.8

在运行发生器之前,我完成了

$ rails new testapp
$ cd testapp

我的ruby版本是ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15],我的rails版本是Rails 4.2.1,我正在使用rbenv。

我想这几乎不可复制......但我找不到任何帖子来帮助我。我不是Ruby on Rails的新手,但我暂时没有使用它。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

不确定为什么它解决了我的问题,但是从rbenv切换到RVM就可以了。

在此之前,我在运行rails server

时开始出现以下错误
/Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json/ext.rb:13:in `require': incompatible library version - /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json/ext/parser.bundle (fatal)
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json/ext.rb:13:in `<module:Ext>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json/ext.rb:12:in `<module:JSON>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json/ext.rb:9:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json.rb:58:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json.rb:58:in `<module:JSON>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/json-1.8.3/lib/json.rb:54:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/activesupport-4.2.1/lib/active_support/core_ext/object/json.rb:2:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/activesupport-4.2.1/lib/active_support/core_ext/object/json.rb:2:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/activesupport-4.2.1/lib/active_support/core_ext/object.rb:12:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/activesupport-4.2.1/lib/active_support/core_ext/object.rb:12:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/configuration.rb:2:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/configuration.rb:2:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/railtie.rb:2:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/railtie.rb:2:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/engine.rb:1:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/engine.rb:1:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/application.rb:6:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/application.rb:6:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails.rb:11:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails.rb:11:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/commands/server.rb:4:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/commands/server.rb:4:in `<top (required)>'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:123:in `require'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:73:in `server'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from /Users/aymericbouzy/Sites/jobwards/vendor/bundle/gems/railties-4.2.1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:9:in `require'
from bin/rails:9:in `<main>'

让我进入了其他论坛,最终我决定尝试使用RVM。