Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMichelle Cannito
8,992 Pointsrails server error: Could not find a JavaScript runtime
Hello, I am following along with a "Getting Started" course that builds a status app (named treehouse) using Ruby on Rails. After I typed this: rails generate scaffold status name:string content:text I got output, but a "Could not find a JavaScript runtime" error msg. What should I do to fix this problem?
4 Answers
Stone Preston
42,016 Pointsinstall execjs and it should use node automatically for you:
$ gem install execjs
alternatively you can also try installing therubyracer and include it in your gem file
$ gem install therubyracer
then add it in your gemfile:
gem "therubyracer"
Stone Preston
42,016 Pointsinstall a JS runtime library like node.js and it should fix the issue. You can download node.js here
Michelle Cannito
8,992 PointsI'm using Windows 8.1. I installed it to C:\Program Files and that didn't work. So I copied/pasted the nodejs folder to the C:\Ruby200 one and it still doesn't work. Please explain how to install node.js after downloading and running the setup wizard. How do you connect it to Ruby on Rails?
Michelle Cannito
8,992 PointsThanks for your help. I couldn't get it to work, so I decided to use the Railsinstaller package instead. It includes Ruby, Rails, Sqlite, Git, Bundler, TinyTDS, SqL Server Support, and a DevKit in one download. I also write Ruby programs and create Rails applications in subdirectories of the installed directory.
I then figured out why the individual install of Ruby and then Rails didn't work when following along: there's a gap. The course video for the lesson begins with a Mac with a totally different prompt than a PC, and with the directory already made. So I made a directory that was not part of the installed directory. I put it in the C: directory because my guess is that that was where the video's created directory was. And I guess that is why it didn't work. I do think instructor notes should be added so that other students with a PC won't have the same problem.
The only downside with the package found at railsinstaller.com is that the 1.9 version of Ruby is used instead of the latest version. This isn't a problem for me at this stage of learning, but I would prefer to have the latest (non-Beta) versions of all the included software.