【vue3】踩坑日记,vite与node版本对应(mac环境)

创建vue3+vite+ts项目时,报错The requested module 'vue' does not provide an export named 'computed';

node版本问题,

Vite 需要 Node.js 版本 14.18+,16+;

升级node版本步骤:

先查看node的版本:

bash 复制代码
node -v;

安装n:

bash 复制代码
npm install -g n

sudo n latest // 升级到最新版本

sudo n stable // 升级到稳定版本

sudo n xx.xx // 升级到具体版本号

我采用的是升级到14.18.2

bash 复制代码
 sudo n 14.18.2

n 切换之后的 node 默认装在 /usr/local/bin/node,先用 which node 检查一下当前使用的 node 是否在这个路径下。是的话,就更新下/etc/profile文件指定:

bash 复制代码
source /etc/profile

node就完美升级到想要的版本,vite抛错也完美解决!

相关推荐
雾蓝回针1 天前
[全网首发]解决Parallels Desktop运行“第五人格“时 使用涂鸦/快捷发言会导致视角偏移的问题
笔记·macos
这儿有一堆花2 天前
视频文件的技术逻辑解析
windows·macos
Sheffi662 天前
iOS Crash 本质与捕获修复方案
macos·ios·cocoa
喵霓2 天前
mac—android-platform-tools介绍
android·macos
malajisi012 天前
鸿蒙PC开发笔记一:HarmonyOS PC 命令行适配指南(Mac 版)
笔记·macos·harmonyos·harmony·鸿蒙pc·harmony pc
喵霓2 天前
mac——安装wget
macos
bioinforiver2 天前
蛋白质设计(六)— — 三剑合璧,mac如何安装ProteinMPNN、Alphafold2
macos
Charles Shan2 天前
Mac上的linux虚拟机踩坑日记
linux·macos
老菜鸟YDZ2 天前
二十多年前的苹果电脑Power Mac G4 MDD音箱修复
macos·苹果电脑·power mac g4·音箱修复
2301_766536052 天前
MacOS操作杂谈
macos