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

7

32

After importing an existing project into RubyMine, I encountered "Rails server launcher wasn't found in the project" when I Run/Edit Configuration.

I've checked this Cannot start the debugger in Rubymine. Rails server launcher wasn't found in project, but deleting the .idea directory and re-open is not helpful.

I can rails server in the Terminal successfully and the rails server runs. So I guess it's likely a RubyMine related thing.

Thanks, Allen

Bracteate answered 9/5, 2015 at 15:25 Comment(6)
I've found that since I migrated to a new computer AND upgraded to the latest Rubymine, I usually have to go into preferences -> Languages and Frameworks -> Ruby SDK and Gems, and set my preferred ruby version. Until I set that, Rubymine will use an old version of Ruby. I need to dig in and set my default in Rubymine one of these days.Missi
@Missi you are right. But I've already set that configuration to the ruby version that works for me... The rails server launcher missing problem persists.... Frustrating... Maybe I should ask in the JetBrain communityBracteate
When you go into the folder on the command line and do a ruby -v, does the version match the version you set in Rubymine?Missi
@Missi I believe so. The ruby -v shows ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]. which matches the ruby version in RubyMine.Bracteate
If you find an answer over at the JetBrains community I hope you will come back and answer your own question for future users. I'll up-vote it.Missi
@Missi Sure. Will do!Bracteate
I
21

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

enter image description here

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

enter image description here

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.

enter image description here

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:

enter image description here

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

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

enter image description here

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:

enter image description here

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
Implosion answered 5/7, 2017 at 9:50 Comment(3)
It is 2020, using IntelliJ 2020.1.1 and the bug still exists - a Rails project is not meaningfully imported by default and is not runable. This walk-through helps! All the gems detected, gem statements show no errors and the rails server can be started. Thanks!Germany
This answer helped, thanks. If when you get to the 'Import Module' step it mysteriously doesn't detect routes.rb, I'm told that removing node_modules and trying may resolve. Weird bug, not sure why it's not been fixed by nowPanettone
While this did not solve my issue, this is the most detailed and best answer I've ever seen on this site.Thermoplastic
B
64

The easiest way to fix it:

  1. Close project
  2. Remove .idea folder from project folder
  3. Open project

Bingo!

NOTE: this workaround seems to no longer work with 2017.2. See RUBY-20144

Banderillero answered 7/8, 2015 at 13:26 Comment(8)
Did this, but it unfortunately states Rails server launcher projects/acme/spec/dummy not found in the project.Bennettbenni
As ridiculous as it sounds, restarting OSX made it work. I resisted, but the guy next to me insisted. I did it and no problems. I hate it when "restart your computer" is the fix.Bennettbenni
Although this works it also blats any other run configurations that you may have, so make sure you have a backup first! :)Alanaalanah
This answer should be accepted as most correct. Works like a charm :)Industrious
After half an hour of Google-ing found this ...and worked for meWallinga
this one should be the most acceptable answer for the question, it worked fine for me.Acumen
Thanks Skydan! Just worked for me on RubyMine 2019.3Affricative
had this problem, probably because I had a project where I moved it from intelliJ community edition to RubyMine 2023. Deleting the folder fixed this issue.Ultimately
I
21

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

enter image description here

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

enter image description here

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.

enter image description here

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:

enter image description here

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

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

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:

enter image description here

enter image description here

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:

enter image description here

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
Implosion answered 5/7, 2017 at 9:50 Comment(3)
It is 2020, using IntelliJ 2020.1.1 and the bug still exists - a Rails project is not meaningfully imported by default and is not runable. This walk-through helps! All the gems detected, gem statements show no errors and the rails server can be started. Thanks!Germany
This answer helped, thanks. If when you get to the 'Import Module' step it mysteriously doesn't detect routes.rb, I'm told that removing node_modules and trying may resolve. Weird bug, not sure why it's not been fixed by nowPanettone
While this did not solve my issue, this is the most detailed and best answer I've ever seen on this site.Thermoplastic
G
3

My variant to solve same problem.

Create new run configuration, but use "Ruby" template instead of "Redmine":

Ruby script field set to path to your redmine rails bin path and Script arguments set to "server -b 127.0.0.1 -p 3000 -e development" for ex.

enter image description here

Gasteropod answered 4/6, 2020 at 14:3 Comment(1)
I have tried this. Initially my rails server was not even starting. I had posted the question here as well #71602655 But now, I am getting, NameError: uninitialized constant ActiveRecord::ConnectionAdapters::MysqlAdapter errorDuomo
B
3

This worked for me

  • Remove the .idea file
  • Invalidate the cache and restart the ide
Birthright answered 17/2, 2021 at 10:22 Comment(1)
Yep, this is generally a good thing to try when Jetbrains is doing strange stuff that you can't figure out.Shrewmouse
I
2

Ok, this RubyMine has some serious issues. My day started out peaceful and then ended as a nightmare, courtesy of RubyMine. All I did was git checkout to a certain version of my repo. Well, when I did that, suddenly the folders in RubyMine disappeared. Yes, that is the first bug. I git checkout 8d4fbd1b5dfce0a3daa16896a603903a And then I open RubyMine and folders are gone! I closed and reopened. Still no folders. I restarted computer and still no folders.

I had to go to Project > File Structure and delete the Module. And then create a new Module. Now the project folders appear. But then I get this obscure error Rails server launcher wasn't found in the project. I have no idea what it means. I go online and they say delete .idea directory in your project. So I do that. And now again I have to delete and recreate the module.

This time it says "overwrite directory" since I have an existing project. I select "Yes" and then I open project and my secrets.yml is gone! Now I had to use secrets.yml I had backed up. And then finally it works.

Seriously, all this just because I wanted to checkout out a specific git commit? Come on.

UPDATE After further investigation, I understand what is going on. There are three critical Intellij Idea files with regards to the Ruby plugin:

/.idea/
MyProject.iml
/MyProjectGemset/

These three files should not be checked into git and should be consistent across the different branches of your project. You might have another *.iml in the project. Delete that and make sure you are using the same .iml throughout the branches.

These two files pertain to your SDK:

 MyProject.iml
/MyProjectGemset/

This file pertains to general configuration:

/.idea/
Infanticide answered 23/6, 2018 at 21:30 Comment(0)
M
1

I've came across this same problem, and a way I found to solve it was to properly defining the root folder of the project when opening it in the first time with RubyMine.

As far as I can understand, ideally you should open the project by pointing the RubyMine to the project's root folder:

my-workplace/
|-- rails-project-name/  <-- point RubyMine here when openning
|   |-- app/
|   |-- bin/
|   |-- config/
|   |-- db/
|   |-- lib/
|   |-- log/
|   |-- public/
|   |-- test/
|   ...
Minorite answered 14/8, 2017 at 15:21 Comment(1)
Thanks, one problem with that is that a rails engine is the root folder, and the dummy app often lives in spec/dummy or test/dummyBennettbenni
A
1

if you follow the solution from Artyom Blagoda on the Windows with ruby installed on the WSL (Ubuntu) you'll get into situation when wsl path (\wsl$\Ubuntu) of ruby script (rails) could not be found by remote (Ubuntu) ruby interpreter. to make it work you need to add path mapping on:

Settings -> Ruby SDK and Gems -> Your remote ruby or RVM -> then click the folder icon above, you'll find a new window where you put:

Local Path: //wsl$/Ubuntu/PATH_TO_YOUR_RAILS_BIN


Remote Path: PATH_TO_YOUR_RAILS_BIN

hope it helps ;)

Atony answered 2/4, 2022 at 11:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.