Run configuration with rbenv error: Rails 3.x launcher script was found instead of Rails 4.x one. You need 'bin/rails' script to launch Rails server. Please update server launcher according to Rails 4.x documentation.

Answered

I'm new to ruby and rails and all that, so it's possible I'm just missing something obvious...
I've got rails at '~/.rbenv/shims/rails';
RM correctly recognizes the rbenv ruby version and rails version under 'Ruby SDK and gems'.

However, when I'm trying to run / debug a rails configuration locally, I'm getting the above error.
Am I missing a step here?
Thanks,
Jhonny

More Info: RM 2016.2 on OSX 10.10.5 and rbenv is set to use ruby v. 2.2.3, gemfile includes rails 4.2.5.2

7 comments
Comment actions Permalink

Another clue that I've found was after installing a plugin (specifically the RuboCop plugin);
I got the following error - ProcessNotCreatedException: Failed to run RuboCop command - is it installed? (SDK=/.rbenv/versions/2.2.3/bin): Cannot run program "rubocop" (in directory "/code/myProj"): error=2, No such file or directory

As with the 'rails' command, the 'rubocop' command works fine from the terminal, but not when run by RM.
That might mean that RM's rbenv config is somehow wrong; but, since it does show up correctly under 'Ruby SDK and gems', I have really no idea how to further troubleshoot this...

0
Comment actions Permalink

Hello,

could you please check how it goes in case you specify Ruby executable under the folder versions, rather than shims? In addition, was this RoR app originally created with Rails 4?

0
Comment actions Permalink

Hi Olga,

Thanks for your reply.

The folder structure Inside versions folder is ./2.2.3/bin where I have rails, ruby, rubocop executables etc..

Based on your suggestion, I've tried the following:

1. creating a symlink from versions/2.2.3/bin/rails and versions/2.2.3/bin/ruby inside versions

2. creating a symlink from shims/rails and shims/ruby inside versions

3. copying shims/rails and shims/ruby into versions


I've restarted and tried to re-run the rails configuration after each of these changes, but got the same error message every time.

Also, the RoR project is an old one, and it was started with rails 3, and later migrated to rails 4.

0
Comment actions Permalink

I meant adding ruby executable from version folder to Ruby SDK and Gems in Preferences (~/.rbenv/versions/2.2.3/bin/ruby). Moreover, does <ProjectRoot>/bin/rails script exist? Please take a look also at the following discussion:

http://stackoverflow.com/questions/18948883/rubymine-is-showing-the-error-message-error-running-development-myproject-ra

1
Comment actions Permalink

/bin/rails did not exist indeed. running 'rake rails:update' as suggested in the linked SO question resolved this. Thank you!

I'm now able to run and debug the rails configuration.
However, with specs, I'm only able to debug; trying to run gets RM stuck on 'initializing tests'; and also, the time it takes to initialize specs when debugging is quite significant. Is there anything that can be done to fix that?
When first running the debugger, it alerted that my version of 'debase' is out-of-date (it's listed as 0.2.1 under 'Ruby SDK and gems' - could that have caused that issue?

Thanks again.

0
Comment actions Permalink

This gem isn't used for running tests but it's worth updating it. Regarding stuck state, would it be possible for you to share the project? (you can write me to rubymine-support@jetbrains.com)

0
Comment actions Permalink

Sorry for failing to follow up - I was actually able to run and debug all configuration using Olga's suggestions.
Thank you very much!

0

Please sign in to leave a comment.