RubyMine error: Unable to run gem 'rails'. Cannot find 'rails'
This problem is caused by ruby
and rails
executable files being located in different directories, normally they should be in the same directory and RubyMine is looking for the rails
script in the same location where the configured ruby
interpreter binary is.
In this particular case the locations were as follows:
/usr/local/bin/rails
/usr/bin/ruby
One of the solutions is to create a symlink of the rails
script in the /usr/bin
directory:
sudo ln -s /usr/local/bin/rails /usr/bin/rails
Rubymine - Rails gem not found
This may help for rubymine.
You need to add ruby sdks
In RubyMine from file -> settings -> ruby Sdk and Gems -> add sdk
You can add multiple ruby version sdks and its gems
You can edit project specific ruby setup after starting project from menu
run -> edit configuration -> ruby sdk (select specific rails environment)
$ which ruby #to get current ruby path
RubyMine 8 doesn't detect Rails gem after installation, cannot create project
The best way to create rails projects is through the command line.
1) Go to the folder where you want to create the project
->$ cd development
2) Create rails project
->$ rails new project_name
3) Open project in Rubymine
->$ mine .
This will open Rubymine to your current project.
I work with Rubymine all the time, and it's best not to worry about the gems it can't install. If you absolutely need the gem, first make sure gem install rails
works. Then attempt to install it using the little pop up about not having all of the installed gems. You may need to uninstall rails to fix the issue.
If the reason you want the gems is to use the debugger, I suggest using the byebug
gem. It's a great gem for debugging and I personally prefer it over the rubymine debugger.
rubymine - Could not find gem jquery-rails
Install this gem separately:
gem install jquery-rails
or via Bundler
bundle install
(in the project directory where your Gemfile is located)
RubyMine error: Unable to find associated Rails Model for ':users' associations failed
Looks like the problem is in RubyMine editor (bug)!
If you run your application let's say on ruby-2.1.5 and you change you RubyMine setting (Ruby SDK and gems) to some other version and then change back to ruby-2.1.5 version, you will get this error.
Quick fix is that you create a new project and copy paste those files there
Why doesn't RubyMine 2018.2 detect my gems?
I got things working! By signing out and back in. :facepalm:
To be specific, I think the key steps were
- Move the
$(rbenv init -)
step from my.zshrc
up to my.zshenv
and/or to.profile
- Signing out and back in.
The key insight was noticing that ~/.rbenv/shims
was missing from the RubyMine Gem Environment despite showing up in both interactive and login shells (in and out of RubyMine), and realizing that while new shells were picking up my .profile
changes, RubyMine itself was probably inheriting its environment variables from my session and I'd need to log out/in to to pick up the changes.
I now see ~/.rbenv/shims
in my RubyMine Gem Environment, and both the Bundler Install command and my run configurations are working again.
Thank you Casper for pointing me in the right direction!
Related Topics
Can't Install Rmagick and Imagemagick on Windows 7
How to Use Factorygirl to Create an Attribute Called "Alias"
How to Join a Table and Count Records in Rails 3
How to Merge Two Hashes That Have Same Keys in Ruby
How to Jump from Do to End of a Ruby Block Using Vim
How to Send a Parameter to a Before Filter
Watermark in Existing PDF in Ruby
How to Run Ruby in Haml in JavaScript Definition
How Does Ruby Handle Array Range Accessing
How to Get Ruby-Debug-Ide to Work
How to Download a Ruby Gem Without Installing It Automatically
Zip Up All Paperclip Attachments Stored on S3
Should Rbenv Be Installed System-Wide, or at a User Level
Heroku and @Font-Face - Embedded Fonts Wont Display on Heroku
How to Replicate Class_Inheritable_Accessor's Behavior in Rails 3.1