有一台内网机器,机器1,这台机器连接不上外网,这台机器上需要进行内网的前端项目的构建打包,
机器1 通过设置私库地址:
npm config set registry http://**.**.**.**/repository/npm-group/
// http://**.**.**.**/repository/npm-group/ registry 地址
去下载前端所需要的依赖;
但是由于前端的项目中用到了node-sass ;
在执行
npm install
的时候,就会遇到以下情况:
> node-sass@4.9.3 install /demo/code/master/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/linux-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.9.3/linux-x64-64_binding.node":
ETIMEDOUT
Timed out attemping to establish a remote connection
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm config set proxy http://example.com:8080
这个时候,需要通过连接github去下载linux-x64-64_binding.node这个依赖;但是由于连接不上外网,所以导致连接超时,npm install 失败。
解决办法1:
设置系统代理: