node-sass 内网 安装问题解决

如果所有网站都能够访问,那么就会省略很多问题。

可是,有都时候,面对的就是只有内网,其他的都不可访问。

安装node-sass会遇到2次到外网下载的问题。

怎么办呢?

1.node-sass的依赖node-gyp下载node-headers.tar.gz(实际安装的时候,报的错误会包含版本),

    需要:

        下载对应的版本的headers文件,比如:node-v8.1.3-headers.tar.gz

          npm config set tarball /tmp/node-headers.tgz

    详细的解决方案可以参考: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

你可能感兴趣的:(node-sass 内网 安装问题解决)