2013-03-15 85 views
0

我想將我的Rails應用程序部署到heroku,但資產編譯失敗。在當地環境中,它運作良好。部署到Heroku時編譯失敗資產

 Your bundle is complete! It was installed into ./vendor/bundle 
     Cleaning up the bundler cache. 
-----> Writing config/database.yml to read from DATABASE_URL 
-----> Preparing app for Rails asset pipeline 
     Running: rake assets:precompile 
     rake aborted! 
     Error: Parse error on line 13: Unexpected 'INDENT' 
     (in /tmp/build_iztv4ybnwpqh/app/assets/javascripts/require_dir/view_after 
_key_recieve.js.coffee) 

Log說13行有意外的縮進,但是我找不到任何錯誤。

root = exports ? this 
class root.ViewAfterKeyRecieveViewModel 
    constructor: -> 
    @isDecoded = ko.observable false 
    @encryptedKey = ko.observable '' 
    @personalPassword = ko.observable '' 
    @decodePassword = '' 

    # do when @personalPassword is changed 
    ko.computed => 
     if @personalPassword() isnt '' 
     @decodePassword = sjcl.decrypt(@personalPassword(), @encryptedKey()) 
     simg = new ScrambledImage044 "/assets/image61.png" # THIS IS LINE 13 
     height: 16 
     width: 12 
     canvasId: 'original' 
     seed: @decodePassword 
     simg.fix() 
     simg.paint() 

    createEncryptedKey: -> 
    # create key and set to @encryptedKey 
    @encryptedKey sjcl.encrypt("todo", "hirakegoma") 

謝謝你的好意。

+0

這可能是標籤,而不是空間的問題。見http://stackoverflow.com/questions/8197466/unexpected-indent-in-coffeescript-example-code – Baldrick 2013-03-15 08:22:11

回答

1

試試這個:

simg = new ScrambledImage044 "/assets/image61.png", # notice the comma 
    height: 16 
    width: 12 
    canvasId: 'original' 
    seed: @decodePassword 

或本:

simg = new ScrambledImage044("/assets/image61.png" 
    height: 16 
    width: 12 
    canvasId: 'original' 
    seed: @decodePassword 
) # notice the parens 
+0

非常感謝!我不明白爲什麼上面的代碼在我的本地環境中運行... – weed 2013-03-15 08:26:38

+1

這確實很奇怪。根據我的經驗,在生產環境中編譯coffescript時總是有缺陷;我認爲在這種模式下解析器配置的默認值可能會更嚴格(並且不允許某些合成糖),但我無法確定。我曾經瘋狂地試圖糾正這樣一個錯誤,只是爲了發現添加parens解決了這個問題... – 2013-03-15 08:51:28

+0

非常感謝! – weed 2013-03-16 01:56:50