解决Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 14.x

今天在新的开发环境检出nodejs的前端项目,运行npm run serve启动项目后报:

> Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 14.x

原因:不清楚,可能是因为node-sass与node版本的问题,但是是node-sass安装失败导致的,需成功安装node-sass

处理:

npm i node-sass --sass_binary_site=https://npm.taobao.org/mirrors/node-sass/

我使用的是这个命令解决的

参考:(40条消息) node-sass安装失败解决方法,终有一款适合我们_小刘先生很努力的博客-CSDN博客_node-sass安装失败

安装node-sass报错,提示node-gyp -v 与node版本不符合解决办法


(40条消息) 安装node-sass报错,提示node-gyp -v 与node版本不符合解决办法_目标前端大佬的博客-CSDN博客

(以下摘自参考文章:https://blog.csdn.net/brenda2314/article/details/105584724) 

npm uninstall node-sass
npm install node-sass

 遂又遇到:

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.

 原因:缺少python环境 (可参考npm install - gyp ERR! find Python 解决方案)

处理:

第一种方式:
安装Python及环境变量配置
一定要安装python2.7的版本
环境变量安装可以参考:http://blog.csdn.net/lyj_viviani/article/details/51763101
如果第一种方式不行可以试试第二种方式。
 
第二种方式:
运行下面代码(以管理员身份运行cmd执行)

npm install --global --production windows-build-tools

 遂遇到

Unexpected end of JSON input while parsing near **********

解决执行: `npm cache clean --force`

再次尝试,终于成功

最后再重新执行

npm uninstall node-sass
npm install node-sass

至此解决

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

几个高兴

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值