内容简介:当你兴高采烈地下载完 Git 仓库中的项目,端起红茶,敲下这时候我就想起一句名言有时生活就像石头,会给你迎头一击。 —— 乔布斯
当你兴高采烈地下载完 Git 仓库中的项目,端起红茶,敲下 yarn
准备开发。不久后你就会发现满屏幕的 error
:
error \node_modules\node-sass: Command failed.
这时候我就想起一句名言
有时生活就像石头,会给你迎头一击。 —— 乔布斯
面对国内网络状况,使用 Yarn 也会出现依赖报错,多数原因是 node-sass 库下载、构建失败:
s3.amazonaws.com
方式一 创建 .npmrc
在代码根目录中创建 .npmrc
文件有助于项目开发人员根据自身环境对 npm
进行配置:
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/ registry=https://registry.npm.taobao.org
方式二 设置淘宝 NPM 镜像
通过命令的方式设置本机的 Yarn 配置文件,将仓库源服务器指向淘宝提供的镜像:
yarn config set registry https://registry.npm.taobao.org -g yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g #yarn config set sass-binary-site https://npm.taobao.org/mirrors/node-sass
方式三 使用代理
使用一个 HTTP/S 代理可以顺利地下载好依赖文件
yarn config set proxy http://127.0.0.1:1080 # 下载完成后删除 http 代理 yarn config delete proxy
参考资料
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- 计算机网络常见基础问题
- 网络组建的相关步骤及其问题解决
- 网络安全入门的16个基本问题
- 调试Kubernetes集群中的网络停顿问题
- 循环神经网络 (RNN) 的长期依赖问题
- 关于网络安全域隔离问题的研究与思考
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
How to Solve It
Zbigniew Michalewicz、David B. Fogel / Springer / 2004-03-01 / USD 59.95
This book is the only source that provides comprehensive, current, and detailed information on problem solving using modern heuristics. It covers classic methods of optimization, including dynamic pro......一起来看看 《How to Solve It》 这本书的介绍吧!