1. 程式人生 >實用技巧 >其它 >yarn/npm依賴node_modules\node-sass: Command failed

yarn/npm依賴node_modules\node-sass: Command failed


yarn/npm依賴node_modules\node-sass: Command failed

前端使用了一個新的後臺管理系統的框架在安裝完依賴之後報了個錯,這個錯誤資訊是和本機安裝的node版本不支援所安裝的依賴裡的版本,解決思路:1、要麼刪除依賴重新安裝。2、要麼把現有的依賴和node的版本進行匹配升級。

node-sass 版本和node版本支援的對照表

https://github.com/sass/node-sass/releases

查到了匹配的版本,我的node版本是16,那我最低能支援的是node-sass 6.0版本。安裝node-sass:

npm install [email protected]

如果安裝失敗,那麼就去刪除依賴重新安裝:

rmdir /s node_modules

重新跑專案成功:

yarn/npm依賴node_modules\node-sass: Command failed