2

看来我和 OP 的人有同样的问题: https ://github.com/seyhunak/twitter-bootstrap-rails/issues/27 但我无法解决它。

执行如下所述的基本 Rails 应用程序: http: //railscasts.com/episodes/328-twitter-bootstrap-basics 尝试rails g bootstrap:install.

我系统上 r/r 的基本版本是:ruby v 1.9.2p320,雪豹 10.6.4 上的 rails 3.1.0

我可以在本地系统上复制的方式:

rails new bsapp --skip-stylesheets
cd bsapp
rails g scaffold product name:string price:decimal --skip-stylesheets

将 gem 'twitter-bootstrap-rails' 添加到 gemfile 中的资产组。

bundle update
rails g bootstrap:install

这就是问题所在。

Hayk-Saakians-Mac:bsapp hayk$ rails g bootstrap:install
/Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:61:in `rescue in lock': uninitialized constant V8::JSError (NameError)
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:60:in `lock'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:19:in `initialize'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:15:in `new'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/java_script/v8_context.rb:15:in `instance'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less/loader.rb:10:in `initialize'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:14:in `new'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:14:in `<module:Less>'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-2.2.1/lib/less.rb:9:in `<top (required)>'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less/rails.rb:6:in `require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less/rails.rb:6:in `<top (required)>'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less-rails.rb:1:in `require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/less-rails-2.2.3/lib/less-rails.rb:1:in `<top (required)>'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/twitter-bootstrap-rails-2.1.3/lib/twitter-bootstrap-rails.rb:9:in `require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/twitter-bootstrap-rails-2.1.3/lib/twitter-bootstrap-rails.rb:9:in `<top (required)>'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `each'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `each'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:55:in `require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320@global/gems/bundler-1.2.0/lib/bundler.rb:128:in `require'
    from /Users/hayk/ror/bsapp/config/application.rb:7:in `<top (required)>'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/commands.rb:21:in `require'
    from /Users/hayk/.rvm/gems/ruby-1.9.2-p320/gems/railties-3.1.0/lib/rails/commands.rb:21:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'
Hayk-Saakians-Mac:bsapp hayk$ 

完整来源: http: //pastebin.com/nXBcq2bB

4

1 回答 1

0

问题的根源是 v8/therubyracer/libv8 的错误/旧/不存在安装

某些版本的 libv8 gem 直接安装失败,而那些安装了 - 他们花了几个小时,所以我认为它们挂起/崩溃(我正在使用上网本,所以这是可以预料的)。

目前,以下配置对我有用:

gem "libv8", "3.11.8.13"
gem "therubyracer", :require => 'v8'
gem "less-rails"
gem "twitter-bootstrap-rails"

在开发和生产中(heroku)

在 ruby​​racer 或 libv8 上有一个与此相关的 github 问题,其中提到了 x86/32 位处理器的问题——我不记得了。

于 2013-05-20T02:39:07.967 回答