Rails服务器和控制台无法加载。

3

使用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

仅此而已,没有其他发生的事情。如果我然后执行stop springrun 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的输出

Gemfile:

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
< p>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

1
你可以给我们展示一下你的 Gemfile 文件和运行 bundle install 命令后的结果吗? - Larry Lv
1
是的,我已经将信息添加到了最初的问题@LarryLv中。 - Linus
1个回答

2
问题出在debug_inspector宝石上,您可以尝试在Gemfile中删除web-console宝石,然后运行bundle install,再次启动服务器。
更新:
或者,如果您想保留web-console宝石,您可以尝试删除已安装的所有宝石,然后重新运行bundle install。根据rails/web-console上的此问题。

我按照你的建议去做了,但现在第一个错误又出现了,它无法加载比我在问题中发布的第一个错误消息更远的内容。 - Linus
这似乎是一个棘手的问题,所以我必须询问一些边角情况。您是否同时安装了rvm和rbenv?或者,您是否通过手动git clone和homebrew两种方式都安装了rbenv? - Larry Lv
好的,我会这样做。您建议通过 GitHub 拉取或使用 brew 安装 rbenv? - Linus
我已经删除了~/.rbenv文件夹,在homebrew中卸载了rbenvruby-build,并从github拉取了它们,但问题仍然存在。我不知道这是否重要,但运行bundle exec which sqlite3会显示:/usr/bin/sqlite3。这与问题有关吗? - Linus
还有一件事,重新安装 Ruby 后,你的打包工具也是新安装的,对吧? - Larry Lv
显示剩余10条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接