共计 1079 个字符,预计需要花费 3 分钟才能阅读完成。
执行 npm install 的时候出现 node-sass 模块无法下载的情况,看地址它是从 github 拉取的
> node-sass@5.0.0 install E:projectDMSWebnode_modulesnode-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v5.0.0/win32-x64-83_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v5.0.0/win32-x64-83_binding.node":
connect ETIMEDOUT 52.74.223.119:443
Timed out whilst downloading the prebuilt binary
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
> node-sass@5.0.0 postinstall E:projectDMSWebnode_modulesnode-sass
> node scripts/build.js
全局切换 npm 源也不行,试了以下命令解决了
npm install --save node-sass --registry=https://registry.npm.taobao.org
--disturl=https://npm.taobao.org/dist --sass-binary-site=http://npm.taobao.org/mirrors/node-sass
参数解释
--registry=https://registry.npm.taobao.org
淘宝 npm 包镜像--disturl=https://npm.taobao.org/dist
淘宝 node 源码镜像,一些二进制包编译时用--sass-binary-site=http://npm.taobao.org/mirrors/node-sass
这个才是 node-sass 镜像
关注作者公众号,订阅推送更多及时的前端资讯、学习资料
正文完