MacOSX Lion 运行服务器没有 therubyracer gem



我正在使用cloud9 ide online但我必须安装gem rmagick。但是 ide 不允许我做并给出了一个错误。所以我决定将我的项目下载到我所在的地区。然后当我尝试捆绑安装时,它会抛出并错误therubyracer.

我虽然 Osx 有自己的方法来处理 java 部分。因此,如果我从 gem 文件中取出 gem rubyracer,捆绑安装工作正常。但是当我说rails server时,我得到一个错误;

rails server
[WARNING] Please install gem 'therubyracer' to use Less.
bin/rails:6: warning: already initialized constant APP_PATH
/Users/emreozkan/Desktop/yedek/Last.1/bin/rails:6: warning: previous definition of APP_PATH was here
Usage: rails COMMAND [ARGS]
The most common rails commands are:
 generate    Generate new code (short-cut alias: "g")
 console     Start the Rails console (short-cut alias: "c")
 server      Start the Rails server (short-cut alias: "s")
 dbconsole   Start a console for the database specified in config/database.yml
             (short-cut alias: "db")
 new         Create a new Rails application. "rails new my_app" creates a
             new application called MyApp in "./my_app"
In addition to those, there are:
 destroy      Undo code generated with "generate" (short-cut alias: "d")
 plugin new   Generates skeleton for developing a Rails plugin
 runner       Run a piece of code in the application environment (short-cut alias: "r")
All commands can be run with -h (or --help) for more information.

编辑 1:

与宝石鞘翅目捆绑安装;

Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies......
Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.2
Using minitest 5.6.0
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.0
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile 0.6.2
Using nokogiri 1.6.6.2
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.6
Using loofah 2.0.1
Using rails-html-sanitizer 1.0.2
Using actionview 4.2.0
Using rack 1.6.0
Using rack-test 0.6.3
Using actionpack 4.2.0
Using globalid 0.3.5
Using activejob 4.2.0
Using mime-types 2.4.3
Using mail 2.6.3
Using actionmailer 4.2.0
Using activemodel 4.2.0
Using arel 6.0.0
Using activerecord 4.2.0
Using ansi 1.5.0
Using bcrypt 3.1.7
Using debug_inspector 0.0.2
Using binding_of_caller 0.7.3.pre1
Using sass 3.4.13
Using bootstrap-sass 3.2.0.0
Using will_paginate 3.0.7
Using bootstrap-will_paginate 0.0.10
Using bundler 1.9.1
Using columnize 0.9.0
Using debugger-linecache 1.2.0
Using slop 3.6.0
Using byebug 3.4.0
Using carrierwave 0.10.0
Using hitimes 1.2.2
Using timers 4.0.1
Using celluloid 0.16.0
Using coderay 1.1.0
Using coffee-script-source 1.9.1.1
Using execjs 2.5.2
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.2.0
Using coffee-rails 4.1.0
Using commonjs 0.2.7
Using ffi 1.9.8
Using formatador 0.2.5
Using rb-fsevent 0.9.4
Using rb-inotify 0.9.5
Using listen 2.10.0
Using lumberjack 1.0.9
Using nenv 0.2.0
Using shellany 0.0.1
Using notiffany 0.0.6
Using method_source 0.8.2
Using pry 0.10.1
Using guard 2.12.5
Using guard-minitest 2.3.1
Using multi_json 1.11.0
Using jbuilder 2.2.3
Using jquery-rails 4.0.3
Using less 2.6.0
Using sprockets 3.0.1
Using tilt 1.4.1
Using less-rails 2.7.0
Using libv8 3.16.14.7
Using sprockets-rails 2.2.4
Using rails 4.2.0
Using mini_backtrace 0.1.3
Using ruby-progressbar 1.7.5
Using minitest-reporters 1.0.5
Using pg 0.17.1
Using rails_serve_static_assets 0.0.4
Using rails_stdout_logging 0.0.3
Using rails_12factor 0.0.2
Using rdoc 4.2.0
Using ref 1.0.5
Using rmagick 2.13.2
Using sass-rails 5.0.1
Using sdoc 0.4.0
Using spring 1.1.3
Using sqlite3 1.3.9
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    /usr/local/opt/ruby/bin/ruby -r ./siteconf20150421-1458-ss9mv4.rb extconf.rb --pre
checking for main() in -lpthread... yes
checking for main() in -lobjc... yes
checking for v8.h... no
*** 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
    --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=/usr/local/Cellar/ruby/2.2.1/bin/$(RUBY_BASE_NAME)
    --with-pthreadlib
    --without-pthreadlib
    --with-objclib
    --without-objclib
    --enable-debug
    --disable-debug
    --with-v8-dir
    --without-v8-dir
    --with-v8-include
    --without-v8-include=${v8-dir}/include
    --with-v8-lib
    --without-v8-lib=${v8-dir}/lib
/usr/local/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.7/ext/libv8/location.rb:50:in `configure': You have chosen to use the version of V8 found on your system (Libv8::Location::System::NotFoundError)
and *not* the one that is bundle with the libv8 rubygem. However,
it could not be located. please make sure you have a version of
v8 that is compatible with 3.16.14.7 installed. You may
need to special --with-v8-dir options if it is in a non-standard
location
thanks,
The Mgmt
    from /usr/local/lib/ruby/gems/2.2.0/gems/libv8-3.16.14.7/lib/libv8.rb:7:in `configure_makefile'
    from extconf.rb:32:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.2.0/gems/therubyracer-0.12.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-11/2.2.0/therubyracer-0.12.2/gem_make.out
An error occurred while installing therubyracer (0.12.2), and Bundler cannot
continue.
Make sure that `gem install therubyracer -v '0.12.2'` succeeds before bundling.

编辑2:

我的宝石文件;

source 'https://rubygems.org'
gem 'rails',                '4.2.0'
gem 'json',             '~> 1.8.2'
gem 'execjs'
gem 'bcrypt',               '3.1.7'
gem 'will_paginate',           '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'bootstrap-sass',       '3.2.0.0'

gem 'carrierwave'
gem 'rmagick',              '2.13.2'
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem 'sass-rails',           '5.0.1'
gem 'uglifier',             '2.5.3'
gem 'coffee-rails',         '4.1.0'
gem 'jquery-rails',         '4.0.3'
gem 'turbolinks',           '2.3.0'
gem 'jbuilder',             '2.2.3'
gem 'sdoc',                 '0.4.0', group: :doc
group :development, :test do
  gem 'sqlite3',     '1.3.9'
  gem 'byebug',      '3.4.0'
  gem 'web-console', '2.0.0.beta3'
  gem 'spring',      '1.1.3'
end
group :test do
  gem 'minitest-reporters', '1.0.5'
  gem 'mini_backtrace',     '0.1.3'
  gem 'guard-minitest',     '2.3.1'
end
group :production do
  gem 'pg',             '0.17.1'
  gem 'rails_12factor', '0.0.2'
end

我在Rapsberry Pi上安装Rails时遇到了类似的问题,因为therubyracer没有用于ARM处理器的软件包。

可以解决安装节点的问题.js您可以在此处下载:https://nodejs.org/download/

安装后,您可以从 Gemfile 中删除therubyracer并再次运行bundle。在你这样做之后,一切都应该没问题...

您还需要将此行添加到您的 Gemfile 中:

gem 'execjs'

然后再次运行bundler

它在这里描述:http://ajacevedo.com/2013/using-node-js-as-a-rails-javascript-runtime/

在您的情况下,Less Gem 需要therubyracer而不是轨道本身。所以这是一个宝石特有的问题。这里已经描述了它:https://github.com/seyhunak/twitter-bootstrap-rails/issues/336

其中一个人似乎是这样解决的:

。无论如何,删除了两个宝石,"TheRubyracer"和"less-rails-bootstrap"。现在使用"bootstrap-sass"。

最新更新