2016-06-06 73 views
0

使用RVM,我在我的目錄中有一個.ruby-version和.ruby-gemset。我在使用Atom進行編輯時嘗試使用rubocop linter。它不斷給我一個我無法追蹤的Ruby版本不匹配錯誤。您會注意到在堆棧跟蹤中,當它運行Rubocop命令時,它不知何故認爲Ruby版本是系統Ruby版本,而不是我目前與RVM一起使用的版本。堆棧跟蹤如下:Ruby版本不匹配Atom rubocop linter

Error: /Users/jaredrader/.rvm/gems/[email protected]/gems/bundler-1.12.5/lib/bundler/definition.rb:417:in `validate_ruby!': Your Ruby version is 2.0.0, but your Gemfile specified 2.1.7 (Bundler::RubyVersionMismatch) 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/bundler-1.12.5/lib/bundler.rb:91:in `setup' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/rubygems-bundler-1.4.4/lib/rubygems-bundler/noexec.rb:94:in `setup' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/rubygems-bundler-1.4.4/lib/rubygems-bundler/noexec.rb:124:in `check' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/rubygems-bundler-1.4.4/lib/rubygems-bundler/noexec.rb:131:in `<top (required)>' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require' 
    from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/rubygems-bundler-1.4.4/lib/rubygems_executable_plugin.rb:4:in `block in <top (required)>' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/executable-hooks-1.3.2/lib/executable-hooks/hooks.rb:50:in `call' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/executable-hooks-1.3.2/lib/executable-hooks/hooks.rb:50:in `block in run' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/executable-hooks-1.3.2/lib/executable-hooks/hooks.rb:49:in `each' 
    from /Users/jaredrader/.rvm/gems/[email protected]/gems/executable-hooks-1.3.2/lib/executable-hooks/hooks.rb:49:in `run' 
    from /Users/jaredrader/.rvm/gems/[email protected]/bin/ruby_executable_hooks:10:in `<main>' 
    at /Users/jaredrader/.atom/packages/linter-rubocop/index.coffee:30:15 

回答

0

我有同樣的問題。這是因爲我已經在我的原子config.cson文件中直接設置了rubocop路徑用於linter-rubocop。如果您指向要使用的ruby版本的路徑,該錯誤將消失。