Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 9.x

Error:Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 9.x —— 問題與解決辦法一覽

可能的問題(一)

npm install 時造成的 node-sass錯誤,
解決方案:

npm rebuild node-sass
npm install

可能的問題(二)

node_module/ node-sass包錯誤
解決方案:

rm -rf node_module/ package-lock.json
npm install

可能的問題(三)

node 版本的問題, node.js 9.x 系列的版本不支持 node-sass。
解決方案:

node -v (查看當前node版本,如果爲 node 版本錯誤,重新下載 node 安裝即可)

可能的問題(四)

如果上述方案都不能解決問題,可能是因爲全局安裝了低版本的 node-sass
解決方案:

npm config get prefix (獲取 npm 全局安裝地址,然後打開 /bin 就可以查看安裝在全局的包)
rm -rf node-sass (需要權限:mac 前面加 sudo,windows 使用管理員模式打開 CMD)
ls (查看是否成功清除 node-sass)
——回到項目目錄
rm -rf node_module/ package-lock.json
npm i

這樣問題就應該解決了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章