Can't install therubyracer, error

痞子三分冷 提交于 2019-12-20 04:14:10

问题


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:


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.



来源:https://stackoverflow.com/questions/7658793/cant-install-therubyracer-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!