File to read not found or unreadable

背景

最近用create-react-app構(gòu)建react項(xiàng)目過程中,使用官方推薦的方法處理scss文件的編譯問題,即node-sass-chokidar,編輯器使用VSCode,在修改scss文件并保存的過程中,出現(xiàn)編譯失敗的問題,報錯內(nèi)容為File to read not found or unreadable,具體如下

{
  "status": 3,
  "message": "File to read not found or unreadable: E:/learn/react-app1/src/index.scss",
  "formatted": "Internal Error: File to read not found or unreadable: E:/learn/react-app1/src/index.scss\n"
}

解決

直接上github的Issue找,這種問題一般不會是個人問題,果不其然,發(fā)現(xiàn)了相關(guān)的Issue,一步一步跟進(jìn)最終找到了解決方法,在node-sass項(xiàng)目的Issue下,解決要點(diǎn):

  • marcosbozzani大神做了修復(fù),修復(fù)分支bug-vscode-watch
  • 此時node-sass最新版本為4.9,版本中未處理此問題
  • 需要手動修復(fù),替換node_modules/node-sass/lib/render.jsrender.js

此問題并不是node-sass的問題,主要是vscode鎖定了文件而造成了文件不可讀,marcosbozzani大神是這么說的The problem seems to be VSCode is still holding the file while node-sass try to access it.

在此記錄一下問題及解決方法,分享給有需要的朋友

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容