execjs issue

Hello, I recently downloaded and installed ruby and rails. The online user guides list commands that I thought were bullet-proof. So when I issued ‘rails server’, I expected anything but a message telling me that execjs was not installed. After I ran ‘gem install execjs’, I copied and pasted the code for test_execjs.rb into a file and issued ‘ruby test_execjs.rb’. This is what I got in return: ruby test_execjs.rb Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. My understanding was that ruby on rails follows conventions that make it easy to set up and get running ASAP. So far, that has not been the case. Am I missing something here? I’d like to get this running so I can actually develop a web application.

Thanks for any suggestions you might have. Joe White

Well, admittedly it’s not quite ‘plug’n’play’ but it doesn’t sound as if you’ve had a particularly difficult time getting going… it’s about par for the course. So, yes, follow the guidance and get yourself a javascript runtime installed. And while you’re at it, if you notice that the (volunteer-maintained) documentation could use some improvement, based on your experience, you can issue a pull request and help out the next guy. That’s how the Rails community operates. Keep in mind, Joe, you’re getting tens of thousands of other people’s work product for free.

Howdy,

Welcome to Rails :slight_smile:

The problem you’ve described is listed here in the getting started guide, along with a solution: http://guides.rubyonrails.org/getting_started.html#starting-up-the-web-server

I agree with you that it’s not the most friendly welcome.

Also, did you follow the getting started guide exactly, step by step? Which operating system & version are you using?

I’d like to know these things so that the documentation can be improved if steps are missing.

Regards,

Michael.

Hello Michael,

Thanks for the link. I had seen this and was following the recommendations. Also followed the getting started guide as close as possible. I am working on a 32-bit version of Fedora 16 (uname -a: 3.3.8-1.fc16.i686.PAE #1 SMP … i686 i386 GNU/Linux), using mysql 5.5.27.

I just now got ‘rails server’ to run. To do so, I had to edit the Gemfile to uncomment ‘therubyracer’ line, and download execjs again. Then I had to run ‘bundle install’ again. It was not clear to me that this was the what needed to be done.

Thank you for your help.

Cheers, Joe White

Hi Les,

Your help is appreciated. After several days, I was frustrated that the commands from the guides were not performing as described. I finally did get the ‘rails server’ command to run (see response to Michael), but I think the ‘bundle install’ bit was not in the documentation up to the point I had read–or I missed it.

I have been involved with the open-source community for quite some time, and know documentation is sometimes not perfect. So, sorry for being short tempered; I do appreciate the help.

Cheers, Joe

I don’t use therubyracer gem but “apt-get install nodejs” instead.

That is why it is not enabled by default on Gemfile.