Rails rake assets:precompile 报错

315046509 · 2014年04月23日 · 最后由 315046509 回复于 2014年04月23日 · 2579 次阅读

求大神帮忙看看!这里是怎么了!我用 production 环境启动服务 报错! 网上查了很久,都没有类似的错误! rake aborted! Asset logical path has no extension: pa /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/asset.rb:36:in initialize' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/base.rb:380:innew' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/base.rb:380:in build_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/index.rb:94:inblock in build_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/caching.rb:58:in cache_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/index.rb:93:inbuild_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/base.rb:287:in find_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/index.rb:61:infind_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:211:in block in find_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:257:inbenchmark' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:210:in find_asset' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:119:inblock in compile' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:in each' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/sprockets/manifest.rb:118:incompile' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in block (3 levels) in define' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-2.11.0/lib/rake/sprocketstask.rb:146:inwith_logger' /home/sc/.rvm/gems/ruby-2.0.0-p353/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in block (2 levels) in define' /home/sc/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:ineval' /home/sc/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks:15:in `

' Tasks: TOP => assets:precompile (See full trace by running task with --trace)

困扰阿!!困扰阿!!这是什么问题阿!!!网上连改解决方案都没有!!。。。。。。

Asset logical path has no extension: pa 这句话的意思是 pa 这个文件在资源的编译路径中,但是 pa 没有扩展名,所以产生了异常。 rails 里 sprockets 默认会把所有的包含在 Asset logical path 中的非 JS 或 CSS 文件编译,所以你到 app/assets/, lib/assets/, vendor/assets下找找看有没有pa这个文件,有的话给它加个扩展名,或者干脆把这个文件移除。

#2 楼 @kayakjiang 谢谢谢谢!!终于解决了!!我把 pa 这个文件删掉了,就可以编译了!!又学到东西了!

需要 登录 后方可回复, 如果你还没有账号请 注册新账号