node版本问题

服务器下载下来的vue项目启动出现下列问题

复制代码
npm ERR! path E:\vueEnv\app\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe E:\vueEnv\app\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm ERR! gyp verb cli   'E:\\vueEnv\\app\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@18.17.1 | win32 | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []

解决方法一

卸载 node-sass

复制代码
 npm uninstall node-sass
 #安装 node对应版本的
  npm i -D sass
  npm cache clean -f
  npm install
  npm serve

之后启动项目又遇到

set NODE_OPTIONS=--openssl-legacy-provider

npm run serve

#启动失败可能配置失败,再次设置

$env:NODE_OPTIONS="--openssl-legacy-provider"

npm run serve

方法二:

降低node版本 直接使用yarn启动

切换node版本

下载nvm管理包

复制代码
https://github.com/coreybutler/nvm-windows/releases

#查看当前版本号 nvm v 有说明安装成功

#输入nvm ls available查看当前版本号

安装命令 nvm install 16.17

使用命令nvm use 16.17

node 常用命令记录

复制代码
#npm更新到最新
npm install -g npm
#npm更新指定版本
npm install npm@7.24.2 -g 
#强制清楚缓存
npm cache clean -f
相关推荐
阿里嘎多学长40 分钟前
2026-04-30 GitHub 热点项目精选
开发语言·程序员·github·代码托管
叶小鸡2 小时前
Java 篇-项目实战-苍穹外卖-笔记汇总
java·开发语言·笔记
AI人工智能+电脑小能手2 小时前
【大白话说Java面试题】【Java基础篇】第22题:HashMap 和 HashSet 有哪些区别
java·开发语言·哈希算法·散列表·hash
时空系3 小时前
第10篇:继承扩展——面向对象编程进阶 python中文编程
开发语言·python·ai编程
CHANG_THE_WORLD4 小时前
python 批量终止进程exe
开发语言·python
古城小栈4 小时前
从 cargo-whero 库中,找到提升 rust 的契机
开发语言·后端·rust
keep one's resolveY5 小时前
SpringBoot实现重试机制的四种方案
java·spring boot·后端
Gary Studio6 小时前
安卓HAL C++基础-智能指针
开发语言·c++
啧不应该啊6 小时前
Day1 Python 与 C 的类型区别
c语言·开发语言
cen__y6 小时前
Linux07(信号01)
linux·运维·服务器·c语言·开发语言