ExecJS::RuntimeError
当我尝试启动 Rails 服务器并且服务器日志给我以下信息时,我得到了:
ActionView::Template::Error (delete operand may not be argument or var
(in /home/sergey/Perfecto/arena/app/assets/javascripts/items.js.coffee)):
47: <%= raw flash_messages %>
48: </div>
49:
50: <%= javascript_include_tag "application" %>
51: <%= yield :javascripts %>
52: <%= yield :scripts %>
53: </body>
我发现发生此错误是因为 Ubuntu 没有安装 javascript 运行时。好的。我已经nodejs v0.6.3
从源安装并尝试按照建议添加gem 'therubyracer'
到我Gemfile
的,但错误仍然出现。
我错过了什么?提前致谢。
我的items.js.coffee
样子是这样的:
jQuery ->
if $('#main.items_controller.new').length > 0
overlay = null
iconOffsetX = 26
iconOffsetY = 52
disableDraggingFor = (el) ->
el.draggable = false
el.onmousedown = (event) ->
event.preventDefault()
return false
$(".draggable_item, #new_items_queue").disableSelection()
$.each $(".draggable_item"), (i, el) ->
disableDraggingFor(el)
showInfobox = (marker,data) ->
boxText = document.createElement("div")
boxText.style.cssText = "height: 100%; background: url('/images/form.png') no-repeat;"
boxText.innerHTML = '<div id="infoboxContent">' + data + '</div>'
myOptions =
content: boxText
disableAutoPan: false
maxWidth: 0
pixelOffset: new google.maps.Size(-79, -386)
zIndex: 0
boxStyle:
width: "650px"
height: "350px"
closeBoxMargin: "10px"
infoBoxClearance: new google.maps.Size(1, 1)
isHidden: false
pane: "floatPane"
enableEventPropagation: false
ib = new InfoBox(myOptions)
oldDraw = ib.draw
ib.draw = ->
oldDraw.apply(@)
jQuery(ib.div_).hide()
jQuery(ib.div_).fadeIn(900)
$("#item_name").focus()
priceResult = $("#converted_price")
$("#item_price").live "keydown keyup keypress focus blur paste change", ->
fx.base = "USD"
fx.rates =
"KGS": 46.4
input = accounting.unformat $("#item_price").val()
result = accounting.formatMoney fx.convert(input, from: "USD", to: "KGS"),
symbol: "сом"
precision: 0
thousand: " "
format:
pos : "%v %s"
neg : "(%v) %s"
zero: "0 %s"
priceResult.html result
ib.open(Gmaps.map.map, marker)
google.maps.event.addListener marker, 'dragstart', ->
ib.hide()
google.maps.event.addListener marker, 'dragend', ->
newPosition = @getPosition()
$.ajax "/items/reverse_geocode",
type: 'GET'
dataType: 'text'
data:
lat: newPosition.lat()
lng: newPosition.lng()
error: (jqXHR, textStatus, errorThrown) ->
console.log "AJAX Error: #{textStatus}"
success: (data, textStatus, jqXHR) ->
$("#item_location").val data
ib.show()
$('#item_latitude').val newPosition.lat()
$('#item_longitude').val newPosition.lng()
google.maps.event.addListener ib, 'domready', ->
$('#change_position').bind 'click', ->
ib.close()
marker.setAnimation google.maps.Animation.BOUNCE
google.maps.event.addListener marker, 'position_changed', ->
setTimeout (->
ib.open(Gmaps.map.map, marker)
), 300
google.maps.event.addListener ib, 'closeclick', ->
marker.setMap(null)
delete marker
$(".draggable_item").draggable("enable")
placeMarker = (location,icon,shadow,kind) ->
$.ajax "/items/reverse_geocode",
type: 'GET'
dataType: 'text'
data:
lat: location.lat()
lng: location.lng()
onlyCountry: true
error: (jqXHR, textStatus, errorThrown) ->
console.log "AJAX Error: #{textStatus}"
success: (data, textStatus, jqXHR) ->
if data != "Киргизия"
humane "Вы можете добавлять объявления только в Кыргызстане"
else
$(".draggable_item").draggable("disable")
marker = new google.maps.Marker
position: location
map: Gmaps.map.map
icon: icon
shadow: shadow
draggable: true
zIndex: 99
$.ajax "/items/new.js",
type: 'GET'
dataType: 'text'
data:
content: kind
lat: location.lat()
lng: location.lng()
error: (jqXHR, textStatus, errorThrown) ->
console.log "AJAX Error: #{textStatus}"
success: (data, textStatus, jqXHR) ->
showInfobox marker, data
Gmaps.map.callback = ->
@.map.mapTypes.set "OSM", new google.maps.ImageMapType(
getTileUrl: (coord, zoom) ->
"http://192.168.0.112/osm_tiles2/" + zoom + "/" + coord.x + "/" + coord.y + ".png"
tileSize: new google.maps.Size(256, 256)
name: "OpenStreetMap"
maxZoom: 18
)
@.map.setMapTypeId("OSM")
overlay = new google.maps.OverlayView()
overlay.draw = ->
overlay.setMap @.map
$.each $(".draggable_item"), ->
$(@).draggable
cursor: "move",
revert: false,
helper: 'clone',
stop: (event,ui) ->
point = new google.maps.Point ui.offset.left+iconOffsetX,ui.offset.top+iconOffsetY
location = overlay.getProjection().fromContainerPixelToLatLng(point)
placeMarker location, $(@).data('marker'), $(@).data('shadow'), $(@).data('kind')