node-sass安装总报错的问题
node-sass
:rainbow: Node.js bindings to libsass
项目地址:https://gitcode.com/gh_mirrors/no/node-sass
免费下载资源
·
将项目下载到本地, 在执行npm install 进行初始化后,很多时候都会遇到node-sass报错问题,各式各样的问题,最后总结下来大多数时候是node版本与node-sass版本不一致导致的,
下图为node版本与node-sass版本关系对照表,可根据相应的node和node-sass版本对另一个做升级降级操作,比如安装指定版本的node-sass等
以下为原来遇到的问题:
node-sass 的安装命令
npm install node-sass --save-dev
尝试了很多种办法,安装淘宝镜像等等一系列操作都不行
比如:
npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install node-sass --save-dev
//安装淘宝镜像
npm config set sass_binary_site=https://npm.taobao.org/mirrors/node-sass
//指定node-sass安装路径
npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
主要报错如下:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@5.0.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@5.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2021-04-07T07_07_36_074Z-debug.log
最后尝试了网上的一种解决方式,终于安装成功了
首先需要卸载未安装成功之前的包残留
npm uninstall node-sass
然后执行如下命令行即可
npm install node-sass@5.0.0 --save-dev --ignore-scripts
原图地址https://blog.csdn.net/chrisy521/article/details/122036023
GitHub 加速计划 / no / node-sass
8.5 K
1.33 K
下载
:rainbow: Node.js bindings to libsass
最近提交(Master分支:2 个月前 )
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> 9 个月前
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> 9 个月前
更多推荐
已为社区贡献4条内容
所有评论(0)