Mercury:SyntaxError:无法从构造函数返回值

时间:2013-02-27 18:27:32

标签: ruby-on-rails

在全新安装rails 3.2.8并在添加Mercury后进行编译时出错:

SyntaxError: cannot return a value from a constructor: "this.element" in class Button
 (in /home/*********/**************/vendor/bundle/ruby/1.8/bundler/gems/mercury-0c048033cd79/app/assets/javascripts/mercury/toolbar.button.js.coffee)

我已经使用Rails 3.2.3成功安装了Mercury,但是无法弄清楚为什么这不起作用。

有什么想法吗?

source 'https://rubygems.org'

gem 'rails', '3.2.8'

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

gem 'mysql2'
gem 'bootstrap-sass'
gem 'simple_form'
gem 'json'
gem 'ckeditor'
gem 'mercury-rails', :git => 'https://github.com/jejacks0n/mercury.git'


gem 'jquery-rails'
# gem 'jquery-ui-rails'

gem "paperclip", "~> 2.7"

# To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0'

# 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'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
    gem 'therubyracer', '0.10.2', :platforms => :ruby
    gem 'libv8', '~> 3.3.10'
    gem 'execjs'
  gem 'uglifier', '>= 1.0.3'
end

3 个答案:

答案 0 :(得分:2)

https://github.com/jejacks0n/mercury/issues/349

我猜你需要锁定coffeescript 1.4.0

这解决了我的问题。

答案 1 :(得分:1)

显然,有一个修复,在github repo,但不是在rubygems上。如果您不想降级coffee-script,只需在Gemfile中指定存储库:

# Gemfile
# ...
gem 'mercury-rails', git: 'git://github.com/jejacks0n/mercury'

然后运行bundle update mercury-rails。这为我解决了这个问题,而无需降级咖啡脚本。

答案 2 :(得分:0)

以下是您实际需要输入gemfile的内容:

gem 'coffee-script-source', '1.4.0'