Rails 4 ExecJS :: ScheduleError中的ProgramError索引
在我的网络应用程序中添加JavaScript后,我现在收到以下错误:
ExecJS::ProgramError in Listings#index [stdin]:16:5: error: unexpected else else ^^^^ (in /Users/Desktop/Rails/foodapp/app/assets/javascripts/orders.js.coffee)
application.html.etb
Foodapp true %> true %> "stripe-key", :content => ENV["STRIPE_PUBLIC_KEY"] %> <div class="alert alert- alert-dismissable"> "flash_#{name}" %>
orders.js.cofee
jQuery -> Stripe.setPublishableKey($('meta[name="stripe-key"]').attr('content')) payment.setupForm() payment = setupForm: -> $('#new_order').submit -> $('input[type=submit]').attr('disabled', true) Stripe.card.createToken($('#new_order'), payment.handleStripeResponse) false handleStripeResponse: (status, response) -> if status == 200 $('#new_order').append($('').val(response.id)) $('#new_order')[0].submit() else $('#stripe_error').text(response.error.message).show() $('input[type=submit]').attr('disabled', false)
listing.index.html.erb
All products
Name Description Stock Price Sold by
listings.show
Name:
Description:
Stock:
Price:
|
的Gemfile
来源’ https://rubygems.org ‘
来源’ https://code.stripe.com ‘
ruby "2.0.0" gem 'rails', '4.0.4' gem 'sqlite3' gem 'sass-rails', '~> 4.0.2' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 1.2' gem 'bootstrap-sass' gem 'devise' gem "figaro" gem 'stripe' group :doc do # bundle exec rake doc:rails generates the API under doc/api. gem 'sdoc', require: false end
我遇到了同样的问题。
我猜这个错误是由16号行的文本缩进引起的。
我正在使用Sublime 3编辑器。 我的解决方案非常简单:
1.在编辑器窗口的右下方更改tab with = 2
属性的tab with = 2
。
2.在同一侧选择“ Convert Indentation to Spaces
”。