“rake assets:precompile” gives punc error

前端 未结 10 702
离开以前
离开以前 2020-12-04 10:56

I\'m trying to precompile my assets for production, but rails doesn\'t seem to be cooperating.

$ bundle exec rake assets:precompile
/home/drderp/.rvm/rubies/         


        
相关标签:
10条回答
  • 2020-12-04 11:37

    A more universal way to find the problem in js-assets: Run rails console and:

    JS_PATH = "app/assets/javascripts/**/*.js"; 
    Dir[JS_PATH].each do |file_name|
      puts "\n#{file_name}"
      puts Uglifier.compile(File.read(file_name))
    end
    
    0 讨论(0)
  • 2020-12-04 11:37

    "/home/drderp/.rvm/rubies/ruby-1.9.3-p194/bin/ruby /home/drderp/.rvm/gems/ruby-1.9.3-p194@global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets"

    There's a space between the bolded portion (between ruby, the backslash, and home).

    I don't know if this was a typo, but it could be your problem because Rails doesn't like spaces in directory names. Rename that folder, and try running your code again.

    0 讨论(0)
  • 2020-12-04 11:41

    I had this same problem. Open your Javascript console in the browser and see where there is an error. I suspect (because it was the solution to my problem), that one of your JS files has an error and it is most likely whatever JS you wrote that used a ">" symbol.

    Good luck error hunting.

    0 讨论(0)
  • 2020-12-04 11:42

    Verify the new JS files that you added in your application include plugins and other added by Bower or something like it.

    Try add one by one to find what file have problem. In my case was in anchor-scroll.js. When I changed to use anchor-scroll.min rake runs ok.

    Change this:

    //= require anchor-scroll/scroll
    

    For:

    //= require anchor-scroll/scroll.min
    
    0 讨论(0)
提交回复
热议问题