1

I want to run a heroku server and after installing ruby and ruby gems, wanted to run ' bundle install'. I received a compile error when trying to install therubyracer and realised it is because therubyracer does not run on windows from here. It is suggested on other several questions to change the gem file to not include therubyracer on windows, and instead use execjs. I downloaded execjs, but how do I change the gem file?

this is my current gem file:

source 'https://rubygems.org'

gem 'sinatra'
gem 'sinatra-contrib'
gem 'heroku'

group :development do
   gem 'less'
end

these are suggestions made here and here

gem 'therubyracer-heroku', '~> 0.8.1.pre3', :platform => :ruby
gem 'therubyracer', :platform => :ruby

I tried inserting either of these lines, which did not work (running 'bundle install' still attempted to install therubyracer and failed.) So I suspect I must add the :platform => :ruby else where.

Can anyone point me to how to modify my gem file to fix this problem?

Thank you!

ps: using Ruby 1.9.3.

Community
  • 1
  • 1
franka
  • 1,867
  • 3
  • 17
  • 31
  • I don't quite understand your question -- why do you want to install therubyracer and/or execjs? To deploy to heroku, or for another reason? What exactly are you trying to do that isn't working, and what does the error look like? – John Bachir Mar 15 '12 at 06:00
  • sorry for being unclear. I am trying to run 'bundle install' in order to deploy on heroku, yet I get the error that >therubyracer< needs to be installed to do this. Yet, as I read, therubyracer is not available for windows, so I am trying to use execjs instead. – franka Mar 15 '12 at 06:01
  • I guess I'm also wondering how to figure out which of the gems in the gem file have dependencies to this mysterious therubyracer, and how I can modify the gem file to ignore this dependency. – franka Mar 15 '12 at 06:05
  • Is this a new heroku app? If so, then you should use the cedar stack (`heroku create --stack cedar`) if possible. Also, FYI, exec JS has to use a javascript runtime. So you install execjs and then one of these runtimes listed: https://github.com/sstephenson/execjs#readme – John Bachir Mar 15 '12 at 06:09
  • Execjs can use any javascript runtime, including rubyracer. I'm pretty sure rails uses execjs by default, so the problem may be that no javascript runtime is installed. – Max Mar 15 '12 at 06:09
  • Yes, we are developing a new heroku app. And yes didn't install the js runtime yet, good point - will try that now. thank you! – franka Mar 15 '12 at 06:12
  • nevermind, did have node.js installed already. Still, running 'bundle install' with the above gem file causes the system to attempt to install therubyracer, which fails... – franka Mar 15 '12 at 06:19
  • Do you have any other ideas how I could solve this? Where / how can I remove the therubyracer dependence in this gem file? – franka Mar 15 '12 at 06:39
  • look in Gemfile.lock -- which gems does it say depend on therubyracer? – John Bachir Mar 15 '12 at 17:55
  • it's not mentioned in the Gemfile.lock. – franka Mar 16 '12 at 00:42

1 Answers1

2

If you are only using therubyracer for asset compilation, and you are deploying to cedar, then you can now leave both of those gems out of your Gemfile and heroku will do the right thing.

From the heroku documentation:

If you were previously using therubyracer or therubyracer-heroku, these gems are no longer required and strongly discouraged as these gems use a very large amount of memory.

John Bachir
  • 22,495
  • 29
  • 154
  • 227