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

相关推荐
出了名的洗发水20 小时前
mac设置共享文件,win用户也可以访问
macos
superbadguy20 小时前
Mac新手入坑
macos
我寄人间雪满头丶21 小时前
GitHub 私有仓库 SSH 访问配置 SOP(Mac / Windows 通用)
macos·ssh·github
2501_9159184121 小时前
iOS App 测试方法,Xcode、TestFlight与克魔(KeyMob)等工具组合使用
android·macos·ios·小程序·uni-app·iphone·xcode
新手村领路人1 天前
macos如何查看修改系统变量或用户变量
macos
旭日跑马踏云飞1 天前
【本地玩AI】在macOS+AppleSilicon安装ComfyUI
人工智能·macos
旭日跑马踏云飞1 天前
【向日葵】macOS连接windows时剪贴板不生效
macos
CrankZ1 天前
[开源] 软软启动台 - 支持 Windows 和 macOS 的软件启动台(Launchpad)
macos
七夜zippoe1 天前
Python多线程性能优化实战:突破GIL限制的高性能并发编程指南
python·macos·多线程·读写锁·gil·rcu
weixin_462446231 天前
使用 pip3 一键卸载当前环境中所有已安装的 Python 包(Linux / macOS / Windows)
linux·python·macos