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 trial

Ruby Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Windows

Mike Hickman
Mike Hickman
19,817 Points

Installing Rails: JScript remains default instead of newly installed Node.js

Howdy,

I'm just starting the Installing Rails portion of my track, and I'm working on installing all of the components on my windows work machine.

All the components (ruby, node.js, git, rails, bundler, etc) that they have you install during this course worked great.

However, the instructor mentions during the video to verify that after starting your rails server, it shows "node.js" as the default Javascript handler. I installed everything step-by-step in the video, but my rails server is still showing "JScript" as the default.

How would I go about changing this to node.js?

Thanks, Mike

2 Answers

Stone Preston
Stone Preston
42,016 Points

sorry forgot you are on windows, you wont have the bashrc file. have you tried rebooting your computer? remove the lines you added then reboot your pc

Mike Hickman
Mike Hickman
19,817 Points

facepalm

I am ALWAYS telling people to reboot after system changes, and for some reason I thought this would be a dynamic change. It switched after reboot. Thanks for taking the time to help me out.

Have a good one, -Mike

Stone Preston
Stone Preston
42,016 Points

add the following to your gemfile:

gem 'execjs'

then in config/boot.rb insert the following line:

ENV['EXECJS_RUNTIME'] = 'Node'

If you want Node to always be your javascript runtime (if you dont want to have to add the 2 lines to every project) open up .bashrc in a text editor and add

export EXECJS_RUNTIME=Node
Mike Hickman
Mike Hickman
19,817 Points

Hi Stone,

Thanks for the reply. I've been looking all over my system for boot.rb and .bashrc but cannot find these anywhere. I've drilled down in ruby folders, done Windows search, etc. Is there a specific directory I need to be searching in for these? (I even have show hidden files on in Windows just in case).

I also got an error while trying the gem command above: C:\Ruby200>gem 'execjs' ERROR: While executing gem ... (Gem::CommandLineError) Unknown command execjs

Tried with and without the quotation marks.

Completely new to this, so I apologize if I'm missing something simple. (this was so much easier on my macbook..bleh.)

-Mike