從上圖第九行代碼可以看出,導致node-sass
安裝失敗的原因是因為無法下載.node
文件,解決辦法就很簡單了,就是我們把文件下載路徑復制一份到瀏覽器里,然后使用瀏覽器下載文件就可以了。
具體方法
1.從node命令行中復制.node
文件下載鏈接并在瀏覽器打開下載文件
https://github.com/sass/node-sass/releases/download/v3.13.0/win32-x64-46_binding.node
2.文件下載成功后,在命令行工具輸入下面指令:
set SASS_BINARY_PATH=D:/WorkCode/win32-x64-46_binding.node //PATH=后面是的下載的.node所在的路徑
設置SASS_BINARY_PATH
環境變量,目的是告訴程序直接使用本地的.node文件,無需從網上下載
3.配置完成,從新輸入指令:
npm i node-sass -D --verbose
接下來你就會發現node-sass安裝成功。
補充:安裝node-sass時,遇到的錯誤MSBUILD: error MSB3428 Visual C++ VCBuild.exe 1) .NET Framework 2.0 SDK Microsoft
使用npm install node-sass時,遇到的錯誤:
解決方法1:
Using node-sass with Visual Studio 2015 Task Runner
https://github.com/sass/node-sass/blob/master/TROUBLESHOOTING.md#windows
解決方法2:
使用cnpm來安裝node-sass
$ npm install cnpm -g --registry=https://registry.npm.taobao.org $ cnpm install node-sass --registry=https://registry.npm.taobao.org
聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com