如果所有網(wǎng)站都能夠訪問蕉堰,那么就會省略很多問題。
可是督赤,有都時候,面對的就是只有內(nèi)網(wǎng)泻蚊,其他的都不可訪問躲舌。
安裝node-sass會遇到2次到外網(wǎng)下載的問題。
怎么辦呢性雄?
1.node-sass的依賴node-gyp下載node-headers.tar.gz(實(shí)際安裝的時候没卸,報(bào)的錯誤會包含版本),
? ? 需要:
? ? ? ? 下載對應(yīng)的版本的headers文件羹奉,比如:node-v8.1.3-headers.tar.gz
? ? ? ? ? npm config set tarball /tmp/node-headers.tgz
? ? 詳細(xì)的解決方案可以參考:https://github.com/nodejs/node-gyp/issues/1133
2.下載linux-x64-57_binding.node,具體可能是其他的版本约计,所有的版本可以參考:https://github.com/sass/node-sass/releases
????Temporary I've fixed the issue by using the taobao mirror:? ??
????????sass_binary_site=https://npm.taobao.org/mirrors/node-sass
????Add this line to?.npmrc?(either global or local).
具體可以參考:????
? ??????https://github.com/sass/node-sass/issues/2230
? ? 或者:????
? ??????????node-sass supports different configuration parameters to change settings related to the sass binary such as binary name, binary path or alternative download path. Following parameters are supported by node-sass:
Variable name.npmrc parameterProcess argumentValue
?SASS_BINARY_PATH=sass_binary_path
These parameters can be used as environment variable:
E.g.?export SASS_BINARY_SITE=http://example.com/
As local or global?.npmrc?configuration file:
E.g.?sass_binary_site=http://example.com/
As a process argument:
E.g.?npm install node-sass --sass-binary-site=http://example.com/
具體請參考:https://github.com/sass/node-sass#binary-configuration-parameters