yarn安裝node-sass報錯問題

react前端項目在用yarn install命令安裝依賴時報錯了,看了下報錯信息是node-sass安裝的時候編譯報錯。
解決方法:
第一步:配置淘寶鏡像
yarn config set registry https://registry.npm.taobao.org -g

第二步:配置下 node-sass 的二進制包鏡像地址
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g
參考:http://www.lxweimin.com/p/b37aa202da5c

npm 安裝node-sass報錯問題解決方案:
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/

node-sass/phantomjs/electron使用淘寶鏡像站
有些軟件包安裝的時候會下載已預編譯好的二進制格式,比如node-sass/phantomjs/electron等等,這幾個軟件包大多數都將編譯好的成品托管在S3上。

這里只貼出npmrc方案。同樣也適用于npm環境變量配置方案:

npm config set electron_mirror https://npm.taobao.org/mirrors/electron/
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
npm config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs/
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容