最近多次遇到这个问题,node16+版本安装或者初始化带有node-sass和sass-loader包的项目报错。翻遍了所有相关文章,总结出以下两种解决办法:

方法一:

卸载旧版本的node-sass和sass-loader,安装sass和sass-loader,不再使用node-sass

npm uninstall sass-loader node-sass
npm install sass-loader@8.0.2 sass@1.26.5 -D
方法二:

安装node16+相对应版本的node-sass和sass-loader

npm i node-sass@6.0.1 sass-loader@10.2.0
如果使用方法二之后报错,可能是安装过程中某些包丢失,尝试以下方法解决:

npm rebuild node-sass

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 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐