RubyMine:在项目中找不到 Rails 服务器启动器 [英] RubyMine: Rails server launcher wasn't found in the project

查看:155
本文介绍了RubyMine:在项目中找不到 Rails 服务器启动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将现有项目导入 RubyMine 后,我在运行/编辑配置时遇到项目中未找到 Rails 服务器启动器".

我已经检查过这个

然后我点击模块,然后点击图标+",然后选择导入模块".

然后我导航到我的 Rails 项目的根目录'/Users/my_username/code/apps/_murmur/skag_server_rails"并点击打开,显示以下内容.

然后我选择了从现有源创建模块"并点击下一步",它显示以下内容,在我的 Rails 项目根旁边显示一个蓝色复选框它找到的目录,所以我再次点击下一步":

然后显示以下窗口,我点击了完成".

我现在已经完成了导入作为模块工作的 Rails 项目,它显示了以下内容,所以我点击了确定",就像我一样现在准备再次尝试运行我的 Rails 服务器:

所以我返回运行 > 编辑配置窗口并点击Rails > skag",我现在可以在其中使用从模块中选择 SDK" 因为现在我刚刚创建的下拉列表中有了我的 "skag_server_rails" 模块,并且没有明显的错误,如下所示:

然后我可以点击确定来保存运行/编辑配置

然后我能够运行服务器运行 > 运行,它显示:

然后我就能够在浏览器中成功打开 Rails 应用程序 open http://localhost:3000

但是当我尝试运行>调试以便我可以使用断点进行调试时,它给了我以下错误:

我通过在终端(IDE 外)中运行以下命令解决了这个问题:

gem install debase --pregem 安装 ruby​​-debug-ide

然后我终于可以运行Run > Debug,它允许我触发断点,如下所示:

重要提示:

我采用的最初方法并没有最终修复涉及在运行">编辑配置"窗口中选择使用使用其他 SDK"将我的 Ruby Gemset 加载到调试配置(而不是使用模块)中的错误.

更新:我最近在 2017 年 9 月 2 日再次遇到了同样的错误,并按照以下步骤来克服它:

  • 转到菜单>文件>项目结构>项目设置>模块>点击+"并选择新模块"
  • 从左侧列表中选择Ruby on Rails"
  • 选择Module SDK"标签为RVM: ruby​​-2.4.1 []"
  • 单击安装 Rails Gem..."下拉菜单中的Rails 版本"标签
    • 选择一个 Rails 版本以供下载并等待(即 5.0.0)
    • 不要选择导致工具提示此版本不完全支持"出现在下方的 Rails 版本(即选择 Rails 版本 >5.1.2 会导致出现这种情况)
  • 单击Rails 版本"标签从下拉列表中完成下载的版本(即 5.0.0)
  • 输入../"的工作目录"标签值
  • 输入模块名称"(即 videotube-5.0.0)
  • 点击应用"和保存"

  • 转到菜单 > 运行 > 编辑配置

    • 更改任何不指向应用程序根文件夹的目录
  • 转到菜单 > 运行 > 调试

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

解决方案

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

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

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.

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:

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

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:

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:

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:

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:

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:

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:在项目中找不到 Rails 服务器启动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆