【问题标题】:MacOSX Lion run server without therubyracer gem没有 therubyracer gem 的 Mac OS X Lion 运行服务器
【发布时间】:2015-04-21 08:42:15
【问题描述】:

我使用的是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:

使用 gem thrubyracer 捆绑安装;

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:

我的 gem 文件;

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

【问题讨论】:

  • 您必须安装 ruby​​ racer gem,因为您的应用程序依赖于它。向我们展示您在安装 ruby​​racer gem 时遇到的错误。
  • 我按照你的要求编辑了

标签: ruby-on-rails macos gem bundle


【解决方案1】:

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

安装node.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 而不是 rails 本身。所以它是一个宝石特定的问题。已在此处描述:https://github.com/seyhunak/twitter-bootstrap-rails/issues/336

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

... 无论如何,删除了两个宝石,“therubyracer”和“less-rails-bootstrap”。现在使用'bootstrap-sass'。

【讨论】:

  • 我按照你所说的从网站上安装了然后我删除了gem 'therubyracer'。但是当我运行 rails server 时仍然是同样的问题。我应该重新启动计算机吗?
  • 我做了,但仍然是同样的错误。在最后下载 node.js 时,它说Node was installed at /usr/local/bin/node npm was installed at /usr/local/bin/npm Make sure that /usr/local/bin is in your $PATH. 我必须做任何事情还是应该没问题?因为没有工作,我收到同样的错误
  • 当你在终端中执行which node 会返回什么?
  • /usr/local/bin/node 。这里是
  • 那么二进制文件的路径在您的PATH 变量中。所以不是这样。在 Mac OS 上时,您可能必须重新启动。我对 Mac OS X 不太熟悉
猜你喜欢
  • 2012-06-09
  • 2012-03-01
  • 1970-01-01
  • 2011-11-16
  • 1970-01-01
  • 2012-01-15
  • 2012-03-11
  • 2016-03-09
  • 2011-10-11
相关资源
最近更新 更多