Rubymine: Rails Server Launcher Wasn't Found in the Project

RubyMine: Rails server launcher wasn't found in the project

I upgraded from RubyMine to IntelliJ Ultimate IDE 2017.1.5 and I encountered the same error "Run Configuration Error: Rails server launcher wasn't found in project". I was using Ruby v2.4.0 with Rails 5.0.2.

It took me an entire day to solve the issue, so I've written a detailed explanation with screenshots to guide others.

It occurred when I tried to Run or Debug my Rails server from within IntelliJ.
Other solutions also didn't fix the error. I tried deleting my .idea/ folder, trying different Ruby or Rails versions (i.e. Ruby v2.3.0 or latest Rails 5.1.2), and even starting a brand new project from scratch. But I could run the Rails server fine using Terminal (outside the IDE) with rails s.

SOLUTION approach:

First I opened Run > Edit Configurations but "Choose SDK from module" didn't have any Project Modules available to select from the drop-down, so I had to create one as follows:

I went to File > Project Structure

Sample Image

Then I clicked Modules, and clicked the icon "+", and selected "Import Module".

Sample Image

Then I navigated to my Rails project's root directory "'/Users/my_username/code/apps/_murmur/skag_server_rails" and clicked Open, which displayed the following.

Sample Image

I then selected "Create module from existing sources" and clicked "Next", and it showed the following, with a blue checkbox shown next to my Rails project root directory that it found, so I clicked "Next" again:

Sample Image

It then showed the following window, and I clicked "Finish".

Sample Image

I'd now finished importing the Rails project I was working on as a Module, and it showed the following, so I clicked "Ok", as I was now ready to try and run my Rails server again:

Sample Image

So I went back to Run > Edit Configurations window and click on "Rails > skag" where I could now use "Choose SDK from module" since there was now my "skag_server_rails" Module available in the drop-down that I just created, and no errors were apparent, as shown below:

Sample Image

I was then able to click Ok to save the Run/Edit Config

I was then able to run the server Run > Run, which displayed:

Sample Image

I was then able to successfully open the Rails app in the browser open http://localhost:3000

But then when I tried to Run > Debug so I could debug using breakpoints, it gave me the following errors:

Sample Image

Sample Image

I solved this by running the following in the Terminal (outside the IDE):

gem install debase --pre
gem install ruby-debug-ide

Then finally I could run Run > Debug and it allowed me to trigger breakpoints as shown below:

Sample Image

Important Note:

The initial approach that I took that DID NOT end up fixing the error involved choosing to use "Use other SDK" within the Run > Edit Configurations window to load my Ruby Gemset into the debug configuration (instead of using a Module).

UPDATE: I encountered the same error again more recently on 2nd September 2017 and followed these steps to overcome it:

  • Go to Menu > File > Project Structure > Project Settings > Modules > Click "+" and select "New Module"
  • Select "Ruby on Rails" from the left hand side list
  • Choose for "Module SDK" label your "RVM: ruby-2.4.1 []"
  • Click for "Rails Version" label the "Install Rails Gem..." drop-down

    • Select a Rails version for it to download and wait (i.e. 5.0.0)
    • Do not select a Rails version that causes the tooltip "This version is not fully supported" to appear below (i.e. selecting a Rails version >5.1.2 causes this to occur)
  • Click for "Rails Version" label the version that finished downloading from the drop-down (i.e. 5.0.0)
  • Enter "Working Directory" label value of "../"
  • Enter a "Module Name" (i.e. videotube-5.0.0)
  • Click "Apply" and "Save"

  • Go to Menu > Run > Edit Configurations

    • Change any directories that do not point to root folder of app
  • Go to Menu > Run > Debug

RubyMine is showing the error message: Error running Development: MyProject: Rails 3.x launcher script was found instead of Rails 4.x one

"Hack" solution:

  1. Create a new Rails 4 project: rails new MyTestRails4Project
  2. Copy the bin folder that is within the MyTestRails4Project
  3. Paste bin folder inside the project that has just been migrated to Rails 4

Update

If the first solution doesn't work, as RiPuk suggested:

Run the rake task: rake rails:update

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.

script/rails was not found, when running rails server (Rails 4)?

Currently this is fixed on the master branch, and most likely the fix will be available in 5.X EAP during the next couple of weeks.

A quick workaround is:

You can copy "rails" script from "bin" to "script" folder as a workaround.
NOTE: if u don't have "script" folder under your project root then please create new folder and name it as "script"(For Rails 4). Then copy "rails" from "bin" folder to it.

Credit goes to community support(Dennis Ushako)

Reference: http://youtrack.jetbrains.com/issue/RUBY-13234

Rails 2.x launcher script was found instead of Rails 3.x one a lot in RubyMine

You probably have the rails 2.x gem attached to your RubyMine settings. Go to File > Settings and take a look at Ruby SDK and Gems. Make sure you have rails 3.x selected, and not something else.



Related Topics



Leave a reply



Submit