未初始化的常量V8 :: JSError(NameError)

时间:2014-02-10 03:52:05

标签: ruby-on-rails twitter-bootstrap less therubyracer uninitialized-constant

当我尝试运行我的RoR应用程序时出现此错误。 在rails server之后,会出现此错误:

未初始化的常量V8 :: JSError(NameError)

E:\Toan\tnkadmin>rails server
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib/less/java_sc
ript/v8_context.rb:61:in `rescue in lock': uninitialized constant V8::JSError (N
ameError)
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less/java_script/v8_context.rb:60:in `lock'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less/java_script/v8_context.rb:19:in `initialize'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less/java_script/v8_context.rb:15:in `new'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less/java_script/v8_context.rb:15:in `instance'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less/loader.rb:13:in `initialize'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less.rb:14:in `new'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less.rb:14:in `<module:Less>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-2.4.0/lib
/less.rb:9:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-rails-2.4
.2/lib/less/rails.rb:6:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-rails-2.4
.2/lib/less/rails.rb:6:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-rails-2.4
.2/lib/less-rails.rb:1:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/less-rails-2.4
.2/lib/less-rails.rb:1:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:72:in `block (2 levels) in require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:70:in `block in require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `each'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler/runtime.rb:59:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/bundler-1.3.5/
lib/bundler.rb:132:in `require'
        from E:/Toan/tnkadmin/config/application.rb:5:in `<top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.1
/lib/rails/commands.rb:74:in `require'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.1
/lib/rails/commands.rb:74:in `block in <top (required)>'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.1
/lib/rails/commands.rb:71:in `tap'
        from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.0.1
/lib/rails/commands.rb:71:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

这是我的宝石文件

source 'https://rubygems.org'
ruby '2.0.0'

gem 'rails', '~> 4.0.0'
#gem 'rails', '3.2.9'

gem 'thin'
gem 'haml'
gem 'jquery-rails'
gem 'i18n'
gem 'exception_notification'

# To use ActiveModel has_secure_password

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 4.0.0'
  gem 'coffee-rails', '~> 4.0.0'
  gem 'uglifier', '>= 1.0.3'
  gem 'less-rails'
  gem 'execjs'
  #gem 'twitter-bootstrap-rails'
  if RUBY_PLATFORM =~ /mingw/
    gem 'therubyracer', path: 'lib/therubyracer-0.11.0beta1-x86-mingw32'
    gem 'libv8', '3.3.10.4'
  else
    gem 'therubyracer', platforms: 'ruby'
  end
end

# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger

group :test, :development do
  gem 'sqlite3'
  gem 'haml-rails'
  gem 'rspec-rails'
  gem 'factory_girl'
  gem 'factory_girl_rails'
  gem 'capybara'
  gem 'database_cleaner'
end

group :test do
  gem 'cucumber-rails'
#  gem 'mysql2'
end

group :production do
  gem 'rails_log_stdout',           github: 'heroku/rails_log_stdout'
  gem 'rails3_serve_static_assets', github: 'heroku/rails3_serve_static_assets'
#  gem 'activerecord-postgresql-adapter'
  gem 'pg'
  gem 'newrelic_rpm'

end

#gem 'execjs'

#gem 'node'

有谁知道如何修复它?

1 个答案:

答案 0 :(得分:0)

如果RUBY_PLATFORM =〜/ mingw /`已经验证,请从当前行中删除此gem 'therubyracer and gem 'libv8', '3.3.10.4''并将其添加到gem 'exception_notification'. is this下方?检查是否安装了rubyracer gem。运行bundle并查看问题是否存在