使用npm install 命令安裝node-sass時,經常出現安裝失敗的情況。原因在於npm服務器在美國,還有就是某強大的防火牆作用。導致模塊無法下載。
1 npm install node-sass
1 Cannot download https://github.com/sass/node-sass/releases/download/v3.4.2/win32-x64-46_binding.node
2
3 Hint: If github.com is not accessible in your location 4 try setting a proxy via HTTP_PROXY, e.g. 5 export HTTP_PROXY=http://example.com:1234
6 or configure npm proxy via 7 npm config set proxy http://example.com:8080'
解決方法:
1、使用淘寶鏡像完成安裝。
1 npm install -g cnpm --registry=https://registry.npm.taobao.org
2 cnpm install node-sass
2、下載翻牆軟件直接完成下載安裝