安装node-sass报错了


#卸载node-sass
npm uninstall node-sass
#安装node-sass
npm install node-sass
能安装成功但是后续npm run dev缺报不兼容错误了

Error:Node Sass version 6.0.0 is incompatible with ^4.0.0

说明node-sass版本太高,不兼容

用下面的命令逐个降低版本装试试呢

#安装6.0.0成功
npm install node-sass@6.0.0
#安装5.0.0成功
npm install node-sass@5.0.0
#安装4.13.0失败
npm install node-sass@4.13.0
可以看到安装高版本成功,安装4.x版本却失败了,网上找到一篇,需要安装MSVC2017和python2.7,或者安装windows-build-tools,实际上windows-build-tools包含的就是这两个。安装命令如下,注意要用管理员权限安装

npm install -g windows-build-tools
安装之后需要校验

C:\Python27\python.exe -V
"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
都能正确返回结果就能安装node-sass@4.x版本了

上面的MSVC2017和python2.7也能单独下载安装,单独下载地址

MSVC2017:https://pan.baidu.com/s/1TcCjimf0fLBHuQjm5KQQeg 提取码: rn8k  

python2.7:https://www.python.org/ftp/python/2.7.15/python-2.7.15.amd64.msi
 

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

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

更多推荐