創(chuàng)建vue3+vite+ts項目時,報錯The requested module ‘vue’ does not provide an export named ‘computed’;
node版本問題,
Vite 需要 Node.js 版本 14.18+,16+;
升級node版本步驟:
先查看node的版本:
node -v;
安裝n:
npm install -g n
sudo n latest // 升級到最新版本
sudo n stable // 升級到穩(wěn)定版本
sudo n xx.xx // 升級到具體版本號
我采用的是升級到14.18.2
sudo n 14.18.2
n 切換之后的 node 默認裝在 /usr/local/bin/node,先用 which node 檢查一下當前使用的 node 是否在這個路徑下。是的話,就更新下/etc/profile文件指定:文章來源:http://www.zghlxwxcb.cn/news/detail-751972.html
source /etc/profile
node就完美升級到想要的版本,vite拋錯也完美解決!文章來源地址http://www.zghlxwxcb.cn/news/detail-751972.html
到了這里,關(guān)于【vue3】踩坑日記,vite與node版本對應(yīng)(mac環(huán)境)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!