ruby-on-rails - rails 服务器和控制台未加载

标签 ruby-on-rails ruby rbenv

使用 rbenvRails 4.2.6,当我运行 bundle exec rails sbundle exec rails c,我看到以下内容:

Ignoring sqlite3-1.3.11 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.11

仅此而已,没有其他事情发生。如果我随后停止 spring,并运行 bundle exec rails c,将出现以下内容:

Ignoring sqlite3-1.3.11 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.11
Ignoring sqlite3-1.3.11 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.11
Ignoring sqlite3-1.3.11 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.11
dyld: lazy symbol binding failed: Symbol not found: _rb_data_typed_object_alloc
  Referenced from: /Users/nandersen/Projects/the-lunch/vendor/bundle/gems/debug_inspector-0.0.2/lib/debug_inspector.bundle
  Expected in: flat namespace

dyld: Symbol not found: _rb_data_typed_object_alloc
  Referenced from: /Users/nandersen/Projects/the-lunch/vendor/bundle/gems/debug_inspector-0.0.2/lib/debug_inspector.bundle
  Expected in: flat namespace

知道这里出了什么问题吗?谢谢!

更新:添加 gemfile 的内容和 bundle install 的输出

gem 文件:

source 'https://rubygems.org'

ruby "2.3.1"
gem 'rails', '4.2.6'
gem 'pg'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'simple_form'
gem "puma"
gem 'dotenv-rails', :groups => [:development, :test]
gem 'quiet_assets', :group => :development
gem "rails_12factor"
gem 'slack-ruby-client'
gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-4-x'
gem 'bootstrap-sass', '~> 3.3.6'

group :development, :test do
  gem 'byebug'
  gem 'rspec-rails', '~> 3.4'
  gem 'factory_girl_rails', '~> 4.0'
end

group :development do
  gem 'web-console', '~> 2.0'
  gem 'guard'
  gem 'guard-rspec', require: false
  gem 'terminal-notifier-guard'
  gem 'spring'
end

bundle install 的输出:

Using rake 11.2.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using execjs 2.7.0
Using debug_inspector 0.0.2
Using sass 3.4.22
Using byebug 9.0.5
Using coderay 1.1.1
Using coffee-script-source 1.10.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using diff-lcs 1.2.5
Using dotenv 2.1.1
Using multipart-post 2.0.0
Using ffi 1.9.10
Using formatador 0.2.5
Using gli 2.14.0
Using rb-fsevent 0.9.7
Using ruby_dep 1.3.1
Using lumberjack 1.0.10
Using nenv 0.3.0
Using shellany 0.0.1
Using method_source 0.8.2
Using slop 3.6.0
Using guard-compat 1.2.1
Using rspec-support 3.4.1
Using hashie 3.4.4
Using multi_json 1.12.1
Using pg 0.18.4
Using puma 3.4.0
Using bundler 1.12.5
Using rails_serve_static_assets 0.0.5
Using rails_stdout_logging 0.0.5
Using tilt 2.0.5
Using websocket-extensions 0.1.2
Using spring 1.7.1
Using terminal-notifier-guard 1.7.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using mime-types 3.1
Using autoprefixer-rails 6.3.6.2
Using uglifier 3.0.0
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using sprockets 3.6.1
Using faraday 0.9.2
Using rb-inotify 0.9.7
Using notiffany 0.1.0
Using pry 0.10.3
Using rspec-core 3.4.4
Using rspec-expectations 3.4.0
Using rspec-mocks 3.4.1
Using rails_12factor 0.0.3
Using websocket-driver 0.6.4
Using sdoc 0.4.1
Using activesupport 4.2.6
Using loofah 2.0.3
Using mail 2.6.4
Using bootstrap-sass 3.3.6
Using faraday_middleware 0.10.0
Using listen 3.1.5
Using rspec 3.4.0
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Using factory_girl 4.7.0
Using jbuilder 2.5.0
Using rails-html-sanitizer 1.0.3
Using slack-ruby-client 0.7.4
Using guard 2.14.0
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using guard-rspec 4.7.2
Using actionview 4.2.6
Using actionpack 4.2.6
Using actionmailer 4.2.6
Using railties 4.2.6
Using sprockets-rails 3.0.4
Using simple_form 3.2.1
Using coffee-rails 4.1.1
Using dotenv-rails 2.1.1
Using factory_girl_rails 4.7.0
Using jquery-rails 4.1.1
Using quiet_assets 1.1.0
Using rails-i18n 4.0.8 from git://github.com/svenfuchs/rails-i18n.git (at rails-4-x@129b9fb)
Using rspec-rails 3.4.2
Using rails 4.2.6
Using sass-rails 5.0.4
Using web-console 2.3.0
Using turbolinks 2.5.3
Bundle complete! 25 Gemfile dependencies, 102 gems now installed.
Bundled gems are installed into ./vendor/bundle.

更新 2 - 添加了 bundle exec gem pristine --all

bundle exec gem pristine --all
Restoring gems to pristine condition...
Restored rake-11.2.2
Restored i18n-0.7.0
Skipped json-1.8.3, it is a default gem
Restored minitest-5.9.0
Restored thread_safe-0.3.5
Restored tzinfo-1.2.2
Restored activesupport-4.2.6
Restored builder-3.2.2
Restored erubis-2.7.0
Restored mini_portile2-2.1.0
Restored pkg-config-1.1.7
Building native extensions.  This could take a while...
ERROR:  While executing gem ... (Gem::Ext::BuildError)
    ERROR: Failed to build gem native extension.

    current directory: /Users/nandersen/Projects/the-lunch/vendor/bundle/gems/nokogiri-1.6.8/ext/nokogiri
/Users/nandersen/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20160620-6035-1m3373p.rb extconf.rb
Ignoring sqlite3-1.3.11 because its extensions are not built.  Try: gem pristine sqlite3 --version 1.3.11
/Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:95:in `block in materialize': Could not find nokogiri-1.6.8 in any of the sources (Bundler::GemNotFound)
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `map!'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/spec_set.rb:88:in `materialize'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:140:in `specs'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:185:in `specs_for'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/definition.rb:174:in `requested_specs'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/environment.rb:19:in `requested_specs'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/runtime.rb:14:in `setup'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler.rb:95:in `setup'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.12.5/lib/bundler/setup.rb:19:in `<top (required)>'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/nandersen/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

extconf failed, exit code 1

Gem files will remain installed in /Users/nandersen/Projects/the-lunch/vendor/bundle/gems/nokogiri-1.6.8 for inspection.
Results logged to /Users/nandersen/Projects/the-lunch/vendor/bundle/extensions/x86_64-darwin-15/2.3.0-static/nokogiri-1.6.8/gem_make.out

最佳答案

问题出在 debug_inspector gem,您可以尝试删除 Gemfile 中的 web-console gem,bundle install,然后运行服务器再次。

更新:

或者如果您想保留 web-console gem,您可以尝试删除所有已安装的 gem,然后重新捆绑安装它们。根据rails/web-console上的这个问题.

关于ruby-on-rails - rails 服务器和控制台未加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37916387/

相关文章:

ruby-on-rails - 在 Haml::Engine 中使用 Rails 方法

zsh - 这是什么意思 >> ~/.zshrc?

ruby-on-rails - Rails 3,如果存在,则为给定 Controller 渲染部分?

ruby-on-rails - 在 Ruby on Rails 中进行异常处理的正确方法是什么?

ruby-on-rails - 如何使用 HTTParty on Rails 发出带有 XML 数据正文的 POST 请求

ruby - 我有一个用于 Rhoconnect :Module error when running rake exec db:restart 的 Rails 未定义方法 `configure'

python - 将字符串编译为 Ruby 字节码以获得更好的性能——就像 Python 中的 compile()

ruby - Ansible "Permission denied"尝试安装/检查 gem 时

ruby - 错误 : Failed to build gem native extension on rubygem installation

ruby-on-rails - 从 Doorkeeper 提供商的多个应用程序中单点注销