Search code examples
ruby-on-railsnetbeans-6.9ubuntu-11.10

Ruby on Rails stopped working after netbeans installation?


2 days ago i succesfully installed Ruby On Rails and started playing with a tutorial. Every was going fine and ws happy. Then today I wanted to continue my tutorial but something did work as usal. First i got this error

ActiveRecord::ConnectionNotEstablished

Hmm googled a bit then thought I should try starting a new project and when i tried to generate a controller i got this message

me@lenovo:~/ror/blog$ rails g controller posts 
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.10/lib/execjs/external_runtime.rb:130:in `which_unix': undefined local variable or method `cmd' for #<ExecJS::ExternalRuntime:0xae47d84> (NameError)

Then I remembered that I installed Netbeans 6.9.1 and RoR module later that day after all things went well. Could it be Netbeans screwing with my RoR installation?

Anyone knows how to reset this? I wont mind getting rid of netbeans if that the deal

Using Ubuntu 11.10


Solution

  • Looks like that there is a mismatch in the methods' variable name; it should be "cmd" but it is "name"

    /Users/kj/.rvm/gems/ruby-1.9.2-p290/gems/execjs-1.2.10/lib/execjs/external_runtime.rb:130:in `which_unix': undefined local variable or method `cmd' for #<ExecJS::ExternalRuntime:0x00000100bf0b48> (NameError)
    

    A quick peek at the file in question reveals:

    def which_unix(name)
     if File.executable? cmd
       cmd
     else
       path = ENV['PATH'].split(File::PATH_SEPARATOR).find { |path|
         File.executable? File.join(path, cmd)
       }
       path && File.expand_path(cmd, path)
     end
    end
    

    Change the method's variable name from "name" to "cmd", save and enjoy!

    —Kai