javascript runtime in rails 3.1.0 and ruby 1.9.2.

2020-03-23 02:33发布

Please help, it's my studying project. It work locally but not online:
Hello, it is said that i dont need special gems like "therubyracer" in rails 3.1.0 but it writes in "heroku logs":

    2011-10-04T23:15:30+00:00 app[web.1]: ActionView::Template::Error (Could not fin
d a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of
available runtimes.
2011-10-04T23:15:30+00:00 app[web.1]:   (in /app/app/assets/javascripts/rails.js
)):....

i was trying to install "therubyracer" but i have error with installing it

C:\proj\lagp>gem install therubyracer
Temporarily enhancing PATH to include DevKit...
Building native extensions.  This could take a while...
ERROR:  Error installing therubyracer:
        ERROR: Failed to build gem native extension.

        C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe extconf.rb
checking for main() in -lpthread... no
creating Makefile

make
C:/RailsInstaller/Ruby1.9.2/bin/ruby -e "puts 'EXPORTS', 'Init_v8'"  > v8-i386-m
ingw32.def
g++ -I. -IC:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/libv8-3.3.10.2/li
b/libv8/v8/include -IC:/RailsInstaller/Ruby1.9.2/include/ruby-1.9.1/i386-mingw32.....

also i made compile:true and precompiled

Here is my app in a github: https://github.com/EnotPoloskun/lagp
take a look plz if you have a time, i wasted 2 days for this problem(
so i dont know what to do(,
Thanks in advance

2条回答
Juvenile、少年°
2楼-- · 2020-03-23 02:57

I'm using Rails 3.1 on Heroku with the assets pipeline, in addition to the assets group in my gemfile I have;

group :production do
 gem 'therubyracer-heroku'
end

which seems to be what you're missing,

查看更多
Melony?
3楼-- · 2020-03-23 03:01

group :production do

gem 'therubyracer-heroku'

end

Then bundle update at local machine before uploading source code to heroku.

查看更多
登录 后发表回答