无法启动 Rails 服务器:在 SDK 中找不到 Rails/无法激活 bundler-1.25.5

Posted

技术标签:

【中文标题】无法启动 Rails 服务器:在 SDK 中找不到 Rails/无法激活 bundler-1.25.5【英文标题】:Unable to start rails server: No Rails found in SDK/ Can't activate bundler-1.25.5 【发布时间】:2016-12-06 19:00:30 【问题描述】:

我正在使用来自 jetbrains 的 ruby​​mine,当我尝试通过点击 Run --> Run 'Development: HelloWorld' 来运行 rails 服务器时,它会说:

运行开发时出错:HelloWorld:[SDK 中未找到 Rails]

我签入了File --> Default Settings... --> Languages & Frameworks --> Ruby SDK and Gems,我按预期使用了rbenv 2.3.1,每个宝石都是最新的,我不必更新它们。所以我尝试通过运行手动执行此操作

rails server

在终端上,我得到了一个错误列表:

/Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/specification.rb:2278:in check_version_conflict': can't activate bundler-1.12.5, already activated bundler-1.13.0.rc.1 (Gem::LoadError) from /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/specification.rb:1404:inactivate' 来自 /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:68:in block in gem' from /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:insynchronize' 来自 /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:in gem' from /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.0.rc.1/lib/bundler/postit_trampoline.rb:32:in' 来自 /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' 来自 /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.13.0.rc.1/lib/bundler/setup.rb:2:in @987654330 @要求' 来自 /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Users/emilychiu/RubymineProjects/HelloWorld/config/boot.rb:3:in' 来自 /Users/emilychiu/RubymineProjects/HelloWorld/bin/rails:8:in require_relative' from /Users/emilychiu/RubymineProjects/HelloWorld/bin/rails:8:in' 来自 /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in load' from /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:incall' 来自 /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in call' from /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:inrun' 来自 /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/bin/spring:49:in <top (required)>' from /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:inload' 来自 /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in <top (required)>' from /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:inrequire' 来自 /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in require' from /Users/emilychiu/RubymineProjects/HelloWorld/bin/spring:13:in' 来自 bin/rails:3:in load' from bin/rails:3:in'

我尝试执行此post 中的步骤并再次运行rails server 给了我同样的错误。

$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.6
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/emilychiu/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/emilychiu/.rbenv/versions/2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/emilychiu/.rbenv/versions/2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/emilychiu/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/emilychiu/.rbenv/versions/2.3.1/etc
- RUBYGEMS PLATFORMS:
  - ruby
  - x86_64-darwin-15
- GEM PATHS:
   - /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
   - /Users/emilychiu/.gem/ruby/2.3.0
- GEM CONFIGURATION:
   - :update_sources => true
   - :verbose => true
   - :backtrace => false
   - :bulk_threshold => 1000
- REMOTE SOURCES:
   - https://rubygems.org/
- SHELL PATH:
   - /Users/emilychiu/.rbenv/versions/2.3.1/bin
   - /usr/local/Cellar/rbenv/1.0.0/libexec
   - /Users/emilychiu/.rbenv/shims
   - /Users/emilychiu/.rbenv/bin
   - /bin
   - /usr/bin
   - /sbin
   - /usr/sbin
   - /usr/local/bin
$ gem install --no-ri --no-rdoc bundler
Successfully installed bundler-1.12.5
1 gem installed
$ rbenv rehash
$ bundle --path=vendor/bundle
Using rake 11.2.2
Using concurrent-ruby 1.0.2
Using i18n 0.7.0
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 2.0.1
Using nio4r 1.2.1
Using websocket-extensions 0.1.2
Using mime-types-data 3.2016.0521
Using arel 7.1.1
Using byebug 9.0.5
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using method_source 0.8.2
Using thor 0.19.1
Using debug_inspector 0.0.2
Using ffi 1.9.14
Using multi_json 1.12.1
Using rb-fsevent 0.9.7
Using puma 3.6.0
Using bundler 1.12.5
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Using sqlite3 1.3.11
Using turbolinks-source 5.0.0
Using tzinfo 1.2.2
Using nokogiri 1.6.8
Using rack-test 0.6.3
Using sprockets 3.7.0
Using websocket-driver 0.6.4
Using mime-types 3.1
Using coffee-script 2.4.1
Using uglifier 3.0.1
Using rb-inotify 0.9.7
Using turbolinks 5.0.1
Using activesupport 5.0.0
Using loofah 2.0.3
Using mail 2.6.4
Using listen 3.0.8
Using rails-dom-testing 2.0.1
Using globalid 0.3.7
Using activemodel 5.0.0
Using jbuilder 2.6.0
Using rails-html-sanitizer 1.0.3
Using spring-watcher-listen 2.0.0
Using activejob 5.0.0
Using activerecord 5.0.0
Using actionview 5.0.0
Using actionpack 5.0.0
Using actioncable 5.0.0
Using actionmailer 5.0.0
Using railties 5.0.0
Using sprockets-rails 3.1.1
Using coffee-rails 4.2.1
Using jquery-rails 4.1.1
Using web-console 3.3.1
Using rails 5.0.0
Using sass-rails 5.0.6
Bundle complete! 15 Gemfile dependencies, 63 gems now installed.
Bundled gems are installed into ./vendor/bundle.

当我再次运行rails server 时,它仍然给我同样的错误。关于如何解决这个问题的任何想法?提前致谢。

【问题讨论】:

【参考方案1】:

要在 Rubymine 中运行 Rails 服务器,请使用热键 ctrl+alt+R 而不是 Run 菜单(请参阅本手册 https://www.jetbrains.com/help/ruby/2016.2/running-rails-server.html)。

在 Rubymine 之外,您的最新捆绑程序似乎是 1.13.0.rc.1,而(可能)Gemfile.lock 正在寻找 1.12。尝试gem uninstall bundler -v 1.13.0.rc.1,然后再次运行bundle exec rails serverbundle exec rails s

【讨论】:

以上是关于无法启动 Rails 服务器:在 SDK 中找不到 Rails/无法激活 bundler-1.25.5的主要内容,如果未能解决你的问题,请参考以下文章

在 Flutter SDK 中找不到 Dart

在控制器中找不到命名空间内的 Ruby on Rails 模型

在 SDK 管理器中找不到 Android 支持存储库

在 Facebook iOS SDK 中找不到 FBDialogClosePNG.h

错误:在 Android SDK 中找不到 gradle 包装器。可能需要更新您的 Android SDK - Android

在你的颤振项目中找不到颤振 sdk 中的飞镖?