Can't install therubyracer, error

2019-03-01 05:54发布

I am trying to instal therubyracer/ therubyracer-heroku to my app, cause it doesn't work in heroku server cause I don't have javascript runtime enviroment.
When I am trying to install these gems it writes:

Installing therubyracer-heroku (0.8.1.pre3) with native extensions C:/RailsInsta
ller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in
block in build_extensions': ERROR: Failed to build gem native extension. (Gem::I
nstaller::ExtensionBuildError)

        C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe extconf.rb
rm -rf build
mkdir -p build
cp -r scons build
mkdir -p build/scons/install
python build/scons/setup.py install --prefix=install
make: python: Command not found
make: *** [build/scons/install/bin/scons] Error 127
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=C:/RailsInstaller/Ruby1.9.2/bin/ruby
extconf.rb:9:in `<main>': Error compiling V8 (RuntimeError)
Compiling V8


Gem files will remain installed in C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9
.1/gems/therubyracer-heroku-0.8.1.pre3 for inspection.
Results logged to C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/therubyra
cer-heroku-0.8.1.pre3/ext/v8/gem_make.out
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/insta
ller.rb:511:in `block in build_extensions'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/insta
ller.rb:486:in `each'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/insta
ller.rb:486:in `build_extensions'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/site_ruby/1.9.1/rubygems/insta
ller.rb:159:in `install'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/source.rb:101:in `block in install'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/source.rb:91:in `install'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/installer.rb:58:in `block (2 levels) in run'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/installer.rb:57:in `block in run'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/installer.rb:49:in `run'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/installer.rb:8:in `install'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/cli.rb:220:in `install'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/vendor/thor/task.rb:22:in `run'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/vendor/thor.rb:263:in `dispatch'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/lib/bundler/vendor/thor/base.rb:386:in `start'
        from C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/bundler-1.0.18
/bin/bundle:13:in `<top (required)>'
        from C:/RailsInstaller/Ruby1.9.2/bin/bundle:19:in `load'
        from C:/RailsInstaller/Ruby1.9.2/bin/bundle:19:in `<main>'

Thanks in advance

1条回答
可以哭但决不认输i
2楼-- · 2019-03-01 06:44

As far as I know, therubyracer(-heroku) simply does not work on Windows. But Windows has its own JavaScript engine, which execjs should be able to locate. So that should work for your development on Windows.

For serving the app on Heroku, you can add the therubyracer-heroku gem as following:

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

:platform => :ruby will use it on C Ruby (MRI) or Rubinius but not Windows.

Also, see Heroku's docs for the Cedar Stack;

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.

查看更多
登录 后发表回答