我使用了来自jetbrains的rubymine,并且在尝试通过点击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:in
激活' 来自/Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:68:inblock in gem' from /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:in
同步' 来自/Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:67:ingem' 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:inrequire' from /Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
要求&#39; 来自/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 {{ 1}}需要&#39; 来自/Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55: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:in
&#39; 来自/ Users / emilychiu / RubymineProjects / HelloWorld / bin / rails:8:inrequire' from /Users/emilychiu/RubymineProjects/HelloWorld/config/boot.rb:3:in
&#39; 来自/Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:inrequire_relative' from /Users/emilychiu/RubymineProjects/HelloWorld/bin/rails:8:in
来电&#39; 来自/Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:inload' from /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in
run&#39; 来自/Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/bin/spring:49:incall' from /Users/emilychiu/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in
loading&#39; 来自/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/RubymineProjects/HelloWorld/vendor/bundle/ruby/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in
要求&#39; 来自/Users/emilychiu/.rbenv/versions/2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55: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:in
&#39; 来自bin / rails:3:require' from /Users/emilychiu/RubymineProjects/HelloWorld/bin/spring:13:in
&#39;
我尝试执行此post中的步骤,并再次运行load'
from bin/rails:3:in
给了我同样的错误。
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.
时,它仍然会给我同样的错误。有关如何解决这个问题的任何想法?提前谢谢。
答案 0 :(得分:1)
要在Rubymine中运行Rails服务器,请使用热键ctrl+alt+R
代替运行菜单(请参阅本手册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 server
或bundle exec rails s
。