Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't launch using from RubyMine

I am having problem with RubyMine 4.0.1 on Windows 7. Every time i run ruby script from RubyMine which contains the only line

require 'rmagick'

I recieve

LoadError: 126: The specified module could not be found.   - C:/Ruby193/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/lib/RMagick2.so
    from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from C:/Ruby193/lib/ruby/gems/1.9.1/gems/rmagick-2.13.1/lib/RMagick.rb:11:in `<top (required)>'
    from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
    from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
    from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
    from (irb):1
    from C:/Ruby193/bin/irb:12:in `<main>'

But when I run the same script from cmd, everything works just fine. I tried to change run configurations, adjusting environment variables, but nothing seemed to work.

like image 792
vladhid Avatar asked Mar 23 '12 09:03

vladhid


People also ask

Can IntelliJ open remote project?

Since working remotely became a necessity, IntelliJ IDEA offers the Remote Development functionality to help you code, run, debug, and deploy your projects remotely.

How do I launch IntelliJ?

To run IntelliJ IDEA, find it in the Windows Start menu or use the desktop shortcut. You can also run the launcher batch script or executable in the installation directory under bin. Run the IntelliJ IDEA app from the Applications directory, Launchpad, or Spotlight.

How do I open IntelliJ in terminal?

From the main menu, select View | Tool Windows | Terminal or press Alt+F12 .


1 Answers

It turned out that the problem was caused by updated system PATH environment not passed to RubyMine process. New PATH value was passed only after machine reboot (logout should also help).

To debug such kind of issues on Windows system it's handy to use such tools like Process Explorer (allows to verify the actual process environment) and Rapid Environment Editor (allows to easily edit environment and detects errors in paths).

Usually it's enough to restart the process to get environment variable changes into account, but in case some custom launcher (explorer) is used, the new process may still inherit its environment and it's required to restart the parent process as well, or logout/reboot.


In this particular case the user has updated system PATH environment to include the ImageMagick directory that contains the DLLs required for RMagick2.so, however RubyMine process didn't get the new value of PATH after IDE restart and was still using the value without ImageMagick DLLs. After system reboot RubyMine started to use the new PATH value and rmagick gem was able to find all the dependencies.

like image 110
CrazyCoder Avatar answered Sep 30 '22 04:09

CrazyCoder