Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"No Gemfile found" error in Run configurations for IntelliJ + Ruby plugin

I've tried to configure my IntelliJ 13.1.5 + Ruby 6.5.2 plugin to run RSpec tests.

When I go to Run -> Edit Configurations and check the checkbox "Run the script in context of the bundle (bundle exec)" in Bundler tab, I get error "Run configuration error: No Gemfile found". See attached screenshot.

My Gemfile is definitely present in the root of working directory. Look for ls -la output below:

drwxr-xr-x  27 lukasm  staff     918 27 Oct 09:23 .
drwxr-xr-x  38 lukasm  staff    1292 13 Oct 15:53 ..
-rw-r--r--@  1 lukasm  staff    6148 20 Oct 11:12 .DS_Store
drwxr-xr-x  16 lukasm  staff     544 27 Oct 15:50 .git
-rw-r--r--   1 lukasm  staff     334  7 Jul 12:14 .gitignore
drwxr-xr-x  13 lukasm  staff     442 27 Oct 15:51 .idea
-rw-r--r--   1 lukasm  staff     203 29 Aug 11:02 .rubocop.yml
-rw-r--r--   1 lukasm  staff       4  7 Jul 12:14 .ruby-gemset
-rw-r--r--   1 lukasm  staff       6  8 Jul 10:51 .ruby-version
-rw-r--r--   1 lukasm  staff     704 20 Oct 18:30 CPS.iml
-rw-r--r--   1 lukasm  staff     396  3 Sep 15:13 Gemfile
-rw-r--r--   1 lukasm  staff    2919 16 Oct 15:04 Gemfile.lock
-rw-r--r--   1 lukasm  staff    3426  7 Jul 12:14 README.md
-rw-r--r--   1 lukasm  staff    7436 24 Oct 17:54 Rakefile
drwxr-xr-x   3 lukasm  staff     102 27 Oct 11:42 config
-rw-r--r--   1 lukasm  staff    5234 13 Oct 16:02 config.yml
-rw-r--r--   1 lukasm  staff    7771 29 Sep 09:46 dump.rdb
-rw-r--r--   1 lukasm  staff  366256  5 Oct 10:28 eir_access.log
-rw-r--r--   1 lukasm  staff     528 26 Sep 16:15 eir_error.log
drwxr-xr-x  10 lukasm  staff     340  5 Aug 12:29 lib
-rw-r--r--   1 lukasm  staff    2168 11 Jul 11:13 results.xml
drwxr-xr-x   4 lukasm  staff     136  5 Aug 12:29 scripts
drwxr-xr-x   9 lukasm  staff     306 20 Oct 11:12 spec
drwxr-xr-x   2 lukasm  staff      68  8 Jul 16:38 src
drwxr-xr-x   9 lukasm  staff     306 16 Oct 15:04 stub_data
drwxr-xr-x   6 lukasm  staff     204 27 Oct 13:55 tmp
-rw-r--r--   1 lukasm  staff     472  7 Jul 12:14 uris.yaml

Question: how can I fix that error "Run configuration error: No Gemfile found" ?

Run -> Edit Configurations

like image 387
LukasMac Avatar asked Oct 27 '14 16:10

LukasMac


1 Answers

I ran into the same issue today and after many hours I was able to fix it.

The environment where this issue occurred was: Ubuntu 14.04.1, IntelliJ 13.1.5, Test::Unit Test runner UI attached for framework, RubyMine plugin 6.0.0.20140123, rbenv and Ruby 2.0.0-p594

To resolve this "Run Configuration error: No Gemfile found", I had to:

  • Delete the Gemfile.lock located at the root of the project
  • From the shell command line, navigate to the project root folder and run "bundle install" so that Bundler started fetching gem metadata from https://rubygems.org/........
  • Go back to Intellij and reselect an SDK for the project at File -> Project Structure
  • Go to edit configuration, delete and recreated the rake configuration

I hope this would work for you... I also did other steps that I don't think they were necessary like restarting Intellij, reimporting the project, checking on and off the Test::Unit and the bundler option

Last, I want to share the steps that I had to do to reproduce this issue from scratch:

  • Imported a ruby project into Intellij
  • From the shell command, installed rbenv then installed ruby 2.0.0-p594
  • From Intellij, navigated to File -> Project Structure -> Project and set the SDK to rbenv 2.0.0-p594
  • From the shell command, installed bundler as follows: gem install bundler
  • Then back to Intellij were I navigated again to File -> Project Structure -> Project and noticed that the SDK was set back to , I set the SDK back to rbenv 2.0.0-p594
  • As soon as I hit ok, a popup showed up in IntellJ asking to install Ruby Plugin Gem Manager so I clicked on "install missing gem" link
  • After the installation was over, I navigated to Edit Configuration, switched to Bundler tab and as soon as I selected Run the script in the context of Bundler check box, I got the "Run Configuration error: No Gemfile found"

So I think that installing bundler late in the project configuration process caused this issue to surface

like image 60
Salem Artin Avatar answered Sep 29 '22 23:09

Salem Artin