npm install node-sass安装失败

**需求:**搭建前端开发环境时,npm install报错,错误提示安装node_modules时,node-sass依赖包安装失败,网上找了好久解决方法,大家提示采用淘宝源等方式安装,都失败了了,尝试了很久终于找到了解决问题的原因, 是因为我们的node 版本太高了,依赖版本对不上了,即使安装上其他的版本依赖,同样运行时,也会报错,这样我们还要解决其他的错误,这样是是得不偿失的,最有效的解决方法是,我们降低node版本和package.json的依赖包版本对应,这样在执行npm install就会通过,后面也不会报错~

错误提示:

复制代码
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs

> node-sass@8.0.0 install D:\temp\npm-temp\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v8.0.0/win32-x64-83_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v8.0.0/win32-x64-83_binding.node":

HTTP error ETIMEDOUT request to https://github.com/sass/node-sass/releases/download/v8.0.0/win32-x64-83_binding.node failed, reason: connect ETIMEDOUT 20.205.243.166:443

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@8.0.0 postinstall D:\temp\npm-temp\node_modules\node-sass
> node scripts/build.js

解决过程:

根据我们依赖包找到我们的node版本,让后降低我们的node版本,一旦 node_modules生成后,我们还可以升回原始版本,还原到我们常用的环境。

管理员权限nvm命令管理node版本:

相关推荐
无所谓^_^20 小时前
个人健康管理系统 | Springboot3 | Vue3
java·vue·毕业设计·springboot·课程设计·毕设·前后端分离
在努力的前端小白1 天前
基于FastAPI+LangChain+LangGraph+Agent+多模态的AI Agent 有渔渔具网站
人工智能·langchain·vue·fastapi
sun_weitao2 天前
用 FastAPI + MQTT 做一个 ESP32最小化跑通示例
中间件·vue·fastapi
怒放的生命19912 天前
本地用 pnpm 省磁盘,团队继续用 npm:极简实践
前端·npm·node.js
江屿风5 天前
【Plain Language Large Model】【从浏览器到全栈:一课精通Node.js三剑客】流食般投喂
笔记·前端框架·npm·node.js·js·npx
汤米粥6 天前
2026年主流前端技术框架
vue·react·elementplus·tailwind css·angular‌·svelte‌·bootstrap‌
codigger6 天前
Vue nextTick 到底在等什么?一篇讲透原理与那些年踩过的坑
程序员·vue·编程·异步更新·#人工智能
咚咚咚小柒7 天前
【前端】LangChain.js学习
前端·javascript·人工智能·typescript·langchain·vue·ai编程
少年的范儿7 天前
Windows 安装 Node.js 教程:nvm 版本管理 + pnpm 安装配置
windows·npm·node.js
peach7 天前
同样是装依赖,为什么 npm 长成 node_modules,Maven 长成 .m2
npm·node.js·maven