最近要维护公司的一个项目,从项目仓库clone 下来后,npm install 之后 报错

分析原因:

node-sass  是c++ 开发的,c++ 在windows环境下是通过python2去编译的,所以可以简单推断是 node-sass的问题

解决思路:

通过package.json  找到node-sass 的版本号可以看到,node-sass  版本是 4.12.0

 而,node-sass,github  官方文档上的说明,对于node-sass 4.14+版本  node 版本支持的情况 是14

 再对应报错信息,可知我现在的node 版本是16.13.0 

得出结论:

node-sass的依赖版本和本地nodejs版本 不对应

解决办法:

把 node 版本进行降级处理(我使用的是 nvm  node版本管理)

降级成功之后 ,再将项目执行 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 个月前
Logo

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

更多推荐