execjs运行时错误和ruby 1.8.7

时间:2014-05-29 22:43:30

标签: ruby-on-rails ruby ruby-on-rails-3

rails g scaffold主体:文字

运行了一个简单的脚手架并得到了这个错误:

/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs.rb:2:in `require': /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:22: syntax error, unexpected ':', expecting ')' (SyntaxError)
      name:        "Node.js (V8)",
           ^
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:22: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:23: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:24: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:26: syntax error, unexpected ')', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:29: syntax error, unexpected ':', expecting ')'
      name:        "JavaScriptCore",
           ^
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:29: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:30: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:32: syntax error, unexpected ')', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:35: syntax error, unexpected ':', expecting ')'
      name:        "SpiderMonkey",
           ^
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:35: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:36: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:37: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:42: syntax error, unexpected ':', expecting ')'
      name:        "JScript",
           ^
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:42: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:43: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:44: syntax error, unexpected ',', expecting kEND
/home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs/runtimes.rb:46: syntax error, unexpected ')', expecting kEND
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/execjs-2.1.0/lib/execjs.rb:2
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1:in `require'
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/coffee-script-2.2.0/lib/coffee_script.rb:1
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1:in `require'
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/coffee-script-2.2.0/lib/coffee-script.rb:1
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1:in `require'
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/coffee-rails-3.2.2/lib/coffee-rails.rb:1
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:68:in `require'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:66:in `require'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `each'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler/runtime.rb:55:in `require'
        from /usr/lib/ruby/gems/1.8/gems/bundler-1.2.1/lib/bundler.rb:128:in `require'
        from /home/tailwind/cms/config/application.rb:7
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/commands.rb:24:in `require'
        from /home/tailwind/cms/vendor/bundle/ruby/1.8/gems/railties-3.2.11/lib/rails/commands.rb:24
        from script/rails:6:in `require'
        from script/rails:6

ruby​​版本1.8.7 rails versin 3.2.11

的Gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.11'

gem "rake"

gem "ruby"

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mysql2'

#gem 'json'
gem 'json','~>1.7.6'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'




  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem 'execjs'

gem 'therubyracer'

#gem 'paperclip'

gem "paperclip", "~> 2.4.3"

gem 'cocaine'

gem 'rmagick'

gem "mini_magick"

gem 'mail'

gem "cancan"
gem 'fancybox-rails'


gem 'authlogic','~>3.2.0'

gem 'RedCloth', '4.2.2'

gem "rails3-generators"




gem 'carrierwave', '>= 0.5.3'

gem 'nested_form'

我不知道如何解决这个问题,所以正确方向上的一点很好也许我需要正确的宝石来运行ruby 1.8.7的exec.js

1 个答案:

答案 0 :(得分:0)

该版本的exec-js需要Ruby 1.9或更高版本,因为它使用新的哈希语法。你必须降级exec-js,或升级你的Ruby。

自从大约一年前的Ruby 1.8.7 reached end-of-life以来,正确的答案就是升级Ruby。