ruby-on-rails - Rails 控制台不会加载,因为扩展尚未构建。有任何想法吗?

标签 ruby-on-rails ruby postgresql rubygems

LMagnotti$ rails c

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 bcrypt-3.1.11 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.11
Ignoring binding_of_caller-0.7.3.pre1 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.3.pre1
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-9.0.3 because its extensions are not built.  Try: gem pristine byebug --version 9.0.3
Ignoring byebug-9.0.0 because its extensions are not built.  Try: gem pristine byebug --version 9.0.0
Ignoring byebug-8.2.5 because its extensions are not built.  Try: gem pristine byebug --version 8.2.5
Ignoring byebug-3.4.0 because its extensions are not built.  Try: gem pristine byebug --version 3.4.0
Ignoring debug_inspector-0.0.2 because its extensions are not built.  Try: gem pristine debug_inspector --version 0.0.2
Ignoring ffi-1.9.10 because its extensions are not built.  Try: gem pristine ffi --version 1.9.10
Ignoring libxml-ruby-2.6.0 because its extensions are not built.  Try: gem pristine libxml-ruby --version 2.6.0
Ignoring nokogiri-1.6.7.2 because its extensions are not built.  Try: gem pristine nokogiri --version 1.6.7.2
Ignoring pg-0.18.4 because its extensions are not built.  Try: gem pristine pg --version 0.18.4
Ignoring sqlite3-1.3.11 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.11
Ignoring sqlite3-1.3.9 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.9
Ignoring sqlite3-1.3.7 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.7
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.
/Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/spec_set.rb:95:in `block in materialize': Could not find rake-11.1.2 in any of the sources (Bundler::GemNotFound)
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/spec_set.rb:88:in `map!'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/spec_set.rb:88:in `materialize'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/definition.rb:140:in `specs'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/definition.rb:185:in `specs_for'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/definition.rb:174:in `requested_specs'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/environment.rb:19:in `requested_specs'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/runtime.rb:14:in `setup'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler.rb:95:in `setup'
    from /Library/Ruby/Gems/2.0.0/gems/bundler-1.12.0/lib/bundler/setup.rb:19:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/LMagnotti/workspace/sample_app/vendor/cache/ruby/2.0.0/gems/spring-1.7.1/lib/spring/commands.rb:33:in `<module:Spring>'
    from /Users/LMagnotti/workspace/sample_app/vendor/cache/ruby/2.0.0/gems/spring-1.7.1/lib/spring/commands.rb:4:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/LMagnotti/workspace/sample_app/vendor/cache/ruby/2.0.0/gems/spring-1.7.1/lib/spring/server.rb:9:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/LMagnotti/workspace/sample_app/vendor/cache/ruby/2.0.0/gems/spring-1.7.1/lib/spring/client/server.rb:9:in `call'
    from /Users/LMagnotti/workspace/sample_app/vendor/cache/ruby/2.0.0/gems/spring-1.7.1/lib/spring/client/command.rb:7:in `call'
    from /Users/LMagnotti/workspace/sample_app/vendor/cache/ruby/2.0.0/gems/spring-1.7.1/lib/spring/client.rb:30:in `run'
    from /Users/LMagnotti/workspace/sample_app/vendor/cache/ruby/2.0.0/gems/spring-1.7.1/bin/spring:49:in `<main>'

所以我现在尝试捆绑安装...

LMagnotti$ bundle install

Ignoring pg-0.18.4 because its extensions are not built.  Try: gem pristine pg --version 0.18.4
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types-data 3.2016.0221
Using arel 6.0.3
Using debug_inspector 0.0.2
Using sass 3.4.22
Using byebug 9.0.3
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using multi_json 1.12.0
Using bundler 1.12.0
Using tilt 2.0.4
Using spring 1.7.1
Using sqlite3 1.3.7
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mime-types 3.0
Using binding_of_caller 0.7.2
Using bootstrap-sass 3.2.0.2
Using coffee-script 2.4.1
Using uglifier 3.0.0
Using sprockets 3.6.0
Using sdoc 0.4.1
Using activesupport 4.2.2
Using loofah 2.0.3
Using mail 2.6.4
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.2
Using jbuilder 2.4.1
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using activejob 4.2.2
Using activerecord 4.2.2
Using actionview 4.2.2
Using actionpack 4.2.2
Using actionmailer 4.2.2
Using railties 4.2.2
Using sprockets-rails 3.0.4
Using coffee-rails 4.1.1
Using jquery-rails 4.1.1
Using rails 4.2.2
Using sass-rails 5.0.4
Using web-console 2.3.0
Using turbolinks 2.5.3
Updating files in vendor/cache
Bundle complete! 14 Gemfile dependencies, 56 gems now installed.
Bundled gems are installed into ./vendor/cache.

一切都好!?不完全的。我现在再次尝试 Rails c 以调出控制台。我还尝试过捆绑更新以及介于两者之间的所有内容。

LMagnotti$ rails c
Warning: Running `gem pristine --all` to regenerate your installed gemspecs(etc....)

....现在我陷入了一个永无休止的循环。有什么想法吗?

此外,在运行明显的“gem pristine --all”命令后:这就是我得到的。

LMagnotti$ sudo gem pristine --all
Restoring gems to pristine condition...
Restored activesupport-4.2.2
Skipped bigdecimal-1.2.8, it is a default gem
Building native extensions.  This could take a while...
Restored binding_of_caller-0.7.2
Restored builder-3.2.2
Building native extensions.  This could take a while...
Restored byebug-9.0.3
Building native extensions.  This could take a while...
Restored debug_inspector-0.0.2
Restored erubis-2.7.0
Building native extensions.  This could take a while...
Restored ffi-1.9.10
Restored i18n-0.7.0
Skipped io-console-0.4.5, it is a default gem
Skipped json-1.8.3, it is a default gem
Building native extensions.  This could take a while...
Restored libxml-ruby-2.8.0
Restored loofah-2.0.3
Restored mini_portile2-2.0.0
Restored minitest-5.8.4
Restored net-telnet-0.1.1
Building native extensions.  This could take a while...
Restored nokogiri-1.6.7.2
Restored power_assert-0.2.6
Skipped psych-2.0.17, it is a default gem
Restored rails-deprecated_sanitizer-1.0.3
Restored rails-dom-testing-2.0.0
Restored rails-dom-testing-1.0.7
Restored rails-html-sanitizer-1.0.3
Restored rake-11.1.2
Restored rake-10.4.2
Skipped rdoc-4.2.1, it is a default gem
Restored rubygems-update-2.6.4
Building native extensions.  This could take a while...
Restored sqlite3-1.3.11
Restored test-unit-3.1.5
Restored thread_safe-0.3.5
Restored tzinfo-1.2.2

然后再次运行 Rails c 后,我们又遇到了同样的问题。

最佳答案

你使用的是rvm之类的东西吗?您安装了多个 ruby 吗?

我发现在安装了多个版本的 ruby​​ 后,我必须为当前使用的 ruby​​ 版本创建一个 gemset,然后“使用”该 gemset,然后才能成功启动 Rails 控制台。

关于ruby-on-rails - Rails 控制台不会加载,因为扩展尚未构建。有任何想法吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37262757/

相关文章:

ruby - Recipe : newrelic-infra 的未定义方法 `poise_service_user'

python - Redshift : SqlAlchemy error on DateDiff call

ruby-on-rails - Rails、Postgres 仅显示所有搜索参数中存在的项目

ruby-on-rails - 如何在Rails应用程序中实现虚名URL?

ruby-on-rails - Rails 6 ActiveStorage 在文件上传失败时恢复事务

ruby-on-rails - 如何使用 boolean 值创建接受/拒绝按钮?

mysql - 迁移以创建表引发 Mysql2::Error: 表不存在

sql - 函数不返回预期值

javascript - rails : Running a function from `application.js` inside a `.js.erb` file

ruby-on-rails - 如何在 rspec 测试中创建临时表