Question

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

Was it helpful?

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

OTHER TIPS

Since I haven't touched NetBeans for a long time, my answer would be a clear no. What I do suspect though, is that ruby 1.9.2-p290 introduces this error. I did upgrade today and bam; it failed on my system the very same way as it did on yours. Thus ... 1.9.2-p290 is the culprit.

--Kai

P.S.> Glad that I could be of help...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top