首页 前端知识 【npm ERR】Failed at the node sass@4.14.1 postinstall script.

【npm ERR】Failed at the node sass@4.14.1 postinstall script.

2025-03-09 15:03:33 前端知识 前端哥 436 177 我要收藏

项目运行 npm install 时报错 Failed at the node sass@4.14.1 postinstall script.

在网网上找了很多解决方案:

  1. 卸载重装node-sass
  2. 使用cnpm下载(不推荐)
  3. 单独设置sass的安装源

发现单独只用某一种方案是不可行的,需要将1、3结合一下,在安装node-sass前记得先排除本地安装的node和node-sass不匹配的问题。

首先,查看node版本

node -v

然后,确定是否匹配,如果不匹配,按照node和node-sass版本对应表,安装正确的node版本

最后,安装node-sass,安装步骤如下:

第一步,先卸载项目里的node-sass

npm uninstall node-sass

第二步,单独设置sass的安装源

// 下载源在国外,更换中国镜像源(淘宝镜像源)
npm config set sass_binary_site = https://registry.npmmirror.com/mirrors/node-sass

第三步,安装node-sass指定版本

// 按照需要的node-sass版本进行安装
npm i node-sass@4.14.1
转载请注明出处或者链接地址:https://www.qianduange.cn//article/23019.html
标签
评论
发布的文章

Autoware安装教程

2025-03-09 15:03:40

【C 】map详解

2025-03-09 15:03:37

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!