2013-06-19 34 views
1

我有具有clean任務來刪除一些緩存文件咕嚕構建腳本。目前此任務,因爲它應該是刪除文件是隻讀的失敗。你如何刪除只讀與咕嚕乾淨的文件?

你如何grunt clean刪除只讀文件?

對於那些誰是好奇,從我的命令的輸出如下:

Running "clean:templates" (clean) task 
Verifying property clean.templates exists in config...OK 
Files: app/cache/dev/twig, app/cache/prod/twig -> templates 
Options: force 
Cleaning "app/cache/dev/twig"...Deleting app/cache/dev/twig...ERROR 
ERROR 
>> Error: Unable to delete "app/cache/dev/twig" file (EPERM, operation not permitted 'app/cache/dev/twig'). 
Warning: Clean operation failed. Use --force to continue. 

app/cache/dev/twig文件夾中的文件是隻讀的並且可以使用命令rm -rf app/cache/dev/twig被刪除。

回答

0

可能有更好的辦法,但如果你有足夠的權限,請嘗試: https://github.com/JamesMGreene/grunt-chmod + grunt-contrib-clean?

chmod: { 
    options: { 
    mode: '755' 
    }, 
    yourTarget1: { 
    src: ['**/*.js'] 
    } 
} 
+0

我確實嘗試了這個作爲解決方法,但是我得到了相同的訪問被拒絕的錯誤。我認爲,這是因爲我通過ACL條目歸因權限的文件。 – Josiah