Unable to create Controller etc from the generators list

Hi,

I'm on RM v3.2.4, Ubuntu 11.4 and Ruby 1.9.2 using RVM.

Having just installed 3.2.4 I'm now unable to use the generators list (ctrl alt g) to create a controller or model etc or to 'reload' the list. All these attempts result in the same error:

/home/rob/.rvm/gems/ruby-1.9.2-p290@ifoc/gems/execjs-1.2.6/lib/execjs/runtimes.rb:46:in `autodetect': Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

I've taken a look at the github page, which doesn't make much sense to me, and tried installing 'therubyracer' for the hell of it but it requires gem 'libv8' which won't install because apparantly it has an 'invalid format'.

Any-one any ideas? Why can't anything work first time :-(

Thanks

Rob

9 comments
Comment actions Permalink

Hello Rob,

Ubuntu 11.04 doesn't have any Javascript rendering engine preinstall, the easiest way to fix it is to install one of the engines listed in the link above. In my case I've installed therubyracer

gem install therubyracer
Hope this helps.

Regards,
Oleg

0
Comment actions Permalink

Hi Oleg,

Thanks for the input. Yep I've already tried installing therubyracer gem but the installation fails with error 'invalid gem format'. What version of RVM (if you're using it) and Ruby did you manage to install therubyracer under?

Cheers

Rob

0
Comment actions Permalink

Hello Rob,

I've managed to install it with  ruby-1.8.7-p302 [ x86_64 ] and rvm 1.0.17

Please ensure that you are using the latest rvm available.

Regards,
Oleg

0
Comment actions Permalink

Oleg,

I'm using RVM 1.8.5 (the very latest version of RVM) and Ruby 1.9.2 (so several generations ahead of you?) with the Rails 3.1 gems and installed the therubyracer gem 0.9.7 (I don't understand why it wouldn't install before). However I'm still getting exactly the same error when attempting to create a Controller.

The exact process I'm following is:

1. Install a new named Rubie with 'rvm install 1.9.2-test1 --with-openssl-dir=$HOME/.rvm/usr'. It's worth noting that without including openssl the debug gems ruby-debug-base19x and ruby-debug-ide will not install (at least not for me). NOTE though that 'the' error occurred both with and without the inclusion of openssl.
2. Navigate to the rvm Rubie, create a new Gemset within in and install Rails 3.1 with simply 'gem install rails'
3. Install 'therubyracers with 'gem install therubyracer'
4. Open up RM and create a new Rails project pointed at the newly created rvm Rubie and Gemset.
5. Let RM run the 'bundle install'
6. Try and create a Controller using the generator, and 'boom' I get the error.


I don't see what I can be doing wrong here.  Any other ideas?

Rob

0
Comment actions Permalink

Oleg,

I've found a/the solution to this. It seems that 'therubyracer' has to be included in the Gem file as "gem 'therubyracer'" even if the gem has already been installed from the command line, otherwise RM throws the aforementioned error. I don't see how including this in the Gem file (and doing a 'bundle install') is any different from installing the gem from the command line. There must be a gap in my knowledge. Any ideas anyone?

Cheers

Rob

0
Comment actions Permalink

Hello Rob,

Thanks a lot for posting the answer. The only reason I can think about is that you have different rvm sdks in RubyMine and in command line. Am I right?

Regards,
Oleg

0
Comment actions Permalink

Hey Oleg,

I've tried this with both multiple and a single Ruby SDK/s installed in RVM and always get the same issue.

If I install therubyracer gem from the command line (using RVM) I can then see the gem in the gem list for the current gemset. If I then go to RM and point the current environment to the SDK that has therubyracer gem already installed in it then the RM gem list shows me that therubyracer gem is installed, but for some reason the gem isn't 'available' until it's included in the gem file and 'bundle install' has run.

I'm not too worried about this because I now have a work around, and in any case therubyracer gem should be declared in the gem file anyway. If I ever find out what's going I'll let you guys know.

Regards,

Rob

0
Comment actions Permalink

Bumping in hopes of a solution.

0

Please sign in to leave a comment.