快速解决 npm 安装 node-sass 速度慢/错误的问题(nexus私服问题见上一篇博客)
node-sass
:rainbow: Node.js bindings to libsass
项目地址:https://gitcode.com/gh_mirrors/no/node-sass
免费下载资源
·
这通常是因为node-sass
包中包含有本地二进制文件(_binding.node
),而在某些情况下,下载过程可能会失败。
以下是一些可能的解决方法:
1. 使用淘宝镜像
你可以尝试使用淘宝的cnpm
命令行工具,该工具使用淘宝的镜像源,可以解决部分下载问题。首先,安装cnpm
:
npm install -g cnpm --registry=https://registry.npm.taobao.org
然后使用cnpm
替代npm
进行包的安装:
cnpm install
2. 配置npm源
在npm的配置中,将registry设置为官方源:
npm config set registry https://registry.npmjs.org/
然后重新尝试安装:
npm install
3. 手动下载二进制包
手动下载缺失的二进制包,将它们放置在正确的目录下。你可以从GitHub Releases下载预编译的node-sass
二进制包。找到与你的Node.js版本和操作系统相匹配的版本,下载并解压。
然后将解压得到的_binding.node
文件复制到node_modules/node-sass/vendor/
目录下。
4. 使用代理
如果你的网络环境受到限制,尝试使用代理或者调整网络配置。
5. 手动设置npm registry
在你的项目目录中,手动创建.npmrc
文件,然后添加以下内容:
registry=https://registry.npmjs.org/
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
保存文件后,重新运行npm install
。
GitHub 加速计划 / no / node-sass
8.5 K
1.33 K
下载
:rainbow: Node.js bindings to libsass
最近提交(Master分支:1 个月前 )
6081731a
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v3...v4)
---
updated-dependencies:
- dependency-name: actions/setup-node
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com> 8 个月前
62c0f46c
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-type: direct:production
update-type: version-update:semver-major
...
Signed-off-by: dependabot[bot] <support@github.com> 8 个月前
更多推荐
已为社区贡献8条内容
所有评论(0)