【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抛错也完美解决!

相关推荐
2501_928094655 小时前
Ps 2025 图像编辑 Photoshop(Mac中文)
图像处理·macos·photoshop·ps
Magnetic_h9 小时前
【iOS】锁的原理
笔记·学习·macos·ios·objective-c·cocoa·xcode
Cosmoshhhyyy20 小时前
mac环境下安装git并配置密钥等
git·macos
肥肥呀呀呀1 天前
mac 安卓模拟器 blueStacks
macos
csdn_aspnet1 天前
如何在 MacOS 上安装 SQL Server
macos·sqlserver
共享家95272 天前
linux-数据链路层
linux·网络·macos
CZIDC3 天前
MacOS字体看起来比在 Windows 上更好?
macos
Cosmoshhhyyy3 天前
linux远程部署dify和mac本地部署dify
linux·运维·macos
行星0083 天前
mac 通过homebrew 安装和使用nvm
macos·npm·node.js