更新时间:2023-07-07 GMT+08:00
node-sass下载失败
问题现象
执行Npm构建任务时,日志报如下异常信息:
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的镜像源需要单独设置,如果没有设置,npm默认会去github下载。从软件开发生产线到github的网络不太稳定,容易下载失败。
处理方法
在默认命令npm install之前先加上如下命令,选择使用华为云的mirror源,重新执行构建即可。
npm config set sass_binary_site https://repo.xxcloud.com/node-sass/
父主题: Npm构建
Npm构建 所有常见问题
- JavaScript heap out of memory
- Unexpected end of JSON ...
- enoent ENOENT: no such file or directory
- Module not found: Error: Can't resolve ...
- NPM构建失败,但不显示错误日志
- npm cb() never called
- gyp ERR! stack Error: EACCES: permission denied
- eslint: error 'CLODOP' is not defined
- node-sass下载失败
- error: could not write config file
- npm构建耗时且安装依赖缓慢
- 找不到依赖版本
more