编译构建 CloudBuild编译构建 CloudBuild

更新时间:2021/07/27 GMT+08:00
分享

node-sass下载失败

问题现象

错误信息如下:

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-72_binding.node": 

read ECONNRESET

...

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.14.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.14.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

原因分析

node-sass的mirror源需要单独设置,如果没有设置,npm默认会去github下载。DevCloud到github的网络不太稳定,容易下载失败。

处理方法

在npm install之前把node-sass的源加上,重新执行构建即可。

npm config set sass_binary_site https://repo.xxx.com/node-sass
分享:

Npm构建 所有常见问题

more