2012-04-12 84 views
0

SO中有類似的問題,但它們中沒有一個似乎包含我的問題的解決方案。rake assets:預編譯錯誤:要導入的文件未找到或無法讀取

簡而言之,爲什麼我會收到以下錯誤,我該如何解決它?

$ rake assets:precompile:all RAILS_ENV=production 
rake aborted! 
File to import not found or unreadable: bootstrap-clubicle.css.erb. 
Load path: ~/Clubicle/Source/clubicle 
    (in ~/Clubicle/Source/clubicle/app/assets/stylesheets/public_portal.css.scss) 

被質疑的@import語句沒有什麼奇怪的。

@import 'bootstrap-clubicle.css.erb'; 

bootstrap-clubicle.css.erb文件確實存在於stylesheets目錄中。

我在OSX 10.6.8上運行Rails 3.1.1。

還值得注意的是,我在EngineYard上部署應用程序時遇到同樣的錯誤。

+0

我有時會在運行rake任務的用戶未設置權限時得到此信息。 – ScottJShea 2012-04-12 03:58:01

+0

我不認爲這是問題所在。這些權限似乎都很好。系統上只有一個用戶。 – 2012-04-12 04:11:28

回答

0

精心支持的人EngineYard終於找到了問題的原因。我有application.css中需要的文件(使用//= require),這些文件也包含在別處(使用@import)。雙重進口導致了這個問題。

1

在經歷了幾個痛苦的時間與這個問題的鬥爭後,我只想添加另一個解決方案,爲我工作。

我application.css文件是這樣的:

/* 
* This is a manifest file that'll be compiled into application.css, which will include all the files 
* listed below. 
* 
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path. 
* 
* You're free to add application-wide styles to this file and they'll appear at the top of the 
* compiled file, but it's generally better to create a new file per style scope. 
* 
*/ 

@import "base"; 

通知,我拿出了:

*= require_self 
*= require_tree . 

,因爲我用的是@import指令導入另一個薩斯文件。

我不得不刪除整個評論 - 不只是要求Sass找到我的@import「base」。一旦我這樣做,導入被發現和應用程序預編譯。

相關問題