添加条带api和coffeescript后出现的问题
Posted
技术标签:
【中文标题】添加条带api和coffeescript后出现的问题【英文标题】:Problems since adding stripe api and coffeescript 【发布时间】:2014-10-25 11:49:55 【问题描述】:嗨,所以我最近从一个教程中添加了一些咖啡脚本,用于使用条纹进行卡验证。我收到一个我不明白的错误,所以如果有人能给我任何指导,我将不胜感激。
ExecJS::RuntimeError in Devise::Sessions#new
SyntaxError: [stdin]:6:22: reserved word "function"
Extracted source (around line #6):
地点 true %> true %> https://js.stripe.com/v2/" %> "stripe-key", :content => ENV["STRIPE_PUBLIC_KEY"] %>
我尝试在 gemfile 中添加各种东西,但并不满意,这是 application.html 的相关部分
<!DOCTYPE html>
<html>
<head>
<title>Site</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= javascript_include_tag "https://js.stripe.com/v2/" %>
<%= csrf_meta_tags %>
<%= tag :meta, :name => "stripe-key", :content => ENV["STRIPE_PUBLIC_KEY"] %>
</head>
<body>
这是 gemfile....
source 'https://code.stripe.com'
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
gem 'bootstrap-sass'
gem "paperclip"
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
gem 'devise'
gem 'figaro'
gem 'stripe'
gem 'therubyracer'
gem 'coffee-script-source'
group :production do
gem 'pg'
gem 'rails_12factor'
end
group :development, :test do
gem 'sqlite3'
end
【问题讨论】:
【参考方案1】:我认为这是缩进的问题,当删除咖啡脚本文件并再次尝试它时......
【讨论】:
以上是关于添加条带api和coffeescript后出现的问题的主要内容,如果未能解决你的问题,请参考以下文章