Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rubymine Not Locating Gems Specified by BUNDLE_PATH

I am using RubyMine IDE with RVM for Ruby version management and

bundler install --path vendor/bundle

to keep my gems local. However, RubyMine doesn't seem to be reading my .bundle/config file which specifies where my gems are located with the BUNDLE_PATH property:

BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'

I have found some sources which indicate that RubyMine should support this, but can't seem to find any explanation of exactly how it works or how to fix it properly.

This thread seems to indicate that RubyMine should pick up the bundler/config

"if you configured bundler to install gems in vendor/bundle by-default then RM is supposed to handle this (and if it is not then this is a bug)." http://devnet.jetbrains.com/thread/441239

Here's a few more RubyMine bugs indicating it is not working:

  • http://youtrack.jetbrains.com/issue/RUBY-9898
  • http://youtrack.jetbrains.com/issue/RUBY-12913
  • http://youtrack.jetbrains.com/issue/RUBY-13988
  • http://youtrack.jetbrains.com/issue/RUBY-12340
  • http://youtrack.jetbrains.com/issue/RUBY-12444
  • http://youtrack.jetbrains.com/issue/RUBY-14542 - I created this one to get their attention since most of the others were closed or have gone cold.

I also saw a stackoverflow thread, Using RVM Gemsets & Bundler & RubyMine, where someone complained about the same problem, but the solution was simply to install the gems under the RVM managed path by doing the following:

bundle install --system

Well, this defeats the purpose of keeping your gems isolated between projects. I know there are gemsets for this, but I much prefer not to use them.

The error I am seeing is the following when I try to run my project from RubyMine:

Error running Development: [No Rails found in SDK]

The other symptom is that my gems installed under vendor/bundle aren't visible under the "External Libraries" in the project view, only my Ruby SDK and bundler are installed here.

Also, this works and starts my server find from the command line: bundle exec rails server

But even when I try to run my server with "Run the script in the context of the bundle (bundle exec)", it still fails.

like image 697
proteantech Avatar asked Oct 31 '13 22:10

proteantech


People also ask

How install missing gems Rubymine?

Install gemsIn the invoked popup, start typing bundler, select bundle install and press Enter . Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .

What are gem files in Ruby?

A Gemfile is a file that is created to describe the gem dependencies required to run a Ruby program. A Gemfile should always be placed in the root of the project directory.


3 Answers

Actually running ruby mine from console through bundle helps!

$ bundle exec rubymine

Good luck!

like image 98
cjf.inc Avatar answered Oct 09 '22 18:10

cjf.inc


Checkout the workarounds posted here:

http://ruby-on-rails.wikidot.com/rubyminelocalbundlepathbug

Workaround #1:

Use a global bundler configuration. Make sure to remove your local bundler configuration too or this won't work.

bundle config --delete path
bundle config --global path vendor/bundle

Workaround #2:

Override the GEM_HOME when starting RubyMine

GEM_PATH="/home/user/project/vendor/bundle/gems/" rubymine
like image 25
proteantech Avatar answered Oct 09 '22 17:10

proteantech


I got the dreaded "Error running Development: [No Rails found in SDK]" error when I had installed my Gems via bundle install --path vendor/bundle. It seems like the --path vendor/bundle confused RubyMine in some way.

Run bundle install without --path vendor/bundle. Note: if you already ran bundler once with --path vendor/bundle, you should either clone a fresh copy of the repo or clean out anything installed by Bundler, like so:

rm -rf .bundle
rm -rf vendor/bundle
bundle install
like image 1
Pete Avatar answered Oct 09 '22 17:10

Pete