谈DevOps平台落地:前端构建怎么这么变态
题记:DevOps 平台通常搭建于内网环境,不能直接外网,所以,如果你也要在内网环境构建前端,就一定会遇到本文所说的问题。 我们发现在 DevOps 平台构建前端项目时,会报这以下这样的错误: node scripts/install.js Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node Cannot download “https://github.com/sass/node-sass/releases/download/v4.9.0/linux-x64-57_binding.node”: tunneling socket could not be established, statusCode=500 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 [email protected] postinstall 以上的错误日志的意思是node在安装 node-sass 时,要去 github.com/sass/node-sass 下载一个名为 linux-x64-57_binding.node 的二进制包。然后它无法下载(其实是因为DevOps平台搭建在企业的内网,是无法直接连接外网的),就建议你设置一下系统的HTTP代理,让它能连接到 github.com。 除此之外,错误日志中,还发现了,node-sass 依赖本身的构建,还需要 Python2 环境: gyp verb check python checking for Python executable "python2" in the PATH gyp verb `which` failed Error: not found: python2 对于一个 Java 后端开发人员,看到这样的错误就懵了。心里在想: ...