更新项目vue版本--入门篇

今天想用下ElementPlus的Form表单,结果给我 Extraneous non-props attributes (ref_key) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. 这样一个警告

出现这个警告跟vue版本有关,于是决定升级vue,执行npm update vue

之前的警告没了。又出现 Feature flag VUE_PROD_HYDRATION_MISMATCH_DETAILS is not explicitly defined. You are running the esm-bundler build of Vue, which expects these compile-time feature flags to be globally injected via the bundler config in order to get better tree-shaki 的问题

在vite.config.js文件中修改如下

export default defineConfig({

plugins: [vue()],

define: {

// enable hydration mismatch details in production build

VUE_PROD_HYDRATION_MISMATCH_DETAILS: 'true'

}

})

没有出现新的问题了。不过我查看package.json文件,vue和vite的版本没有更新。

查看vue版本

npm list vue

npm list vue version

npm info vue (详细查看vue版本号)

npm view vue version(简单查看vue版本号)

通过以上命令查看vue版本都显示了更新后的版本,项目运行又没有出错,估计是package.json不会自动更新

安装 npm install npm-check-updates -g

‌**npm-check-updates是一款实用工具,专门用于更新项目中的package.json文件依赖至最新版本。**‌

安装过后执行2步,1.ncu(检查最新版本),2.ncu -u(更新到最新版本),然后查看package.json,已更新到最新版本

注意不能单更新vite,vite和vue需要匹配

相关推荐
袁煦丞10 分钟前
2025.8.18实验室【代码跑酷指南】Jupyter Notebook程序员的魔法本:cpolar内网穿透实验室第622个成功挑战
前端·程序员·远程工作
Joker Zxc15 分钟前
【前端基础】flex布局中使用`justify-content`后,最后一行的布局问题
前端·css
无奈何杨18 分钟前
风控系统事件分析中心,关联关系、排行、时间分布
前端·后端
Moment24 分钟前
nginx 如何配置防止慢速攻击 🤔🤔🤔
前端·后端·nginx
晓得迷路了29 分钟前
栗子前端技术周刊第 94 期 - React Native 0.81、jQuery 4.0.0 RC1、Bun v1.2.20...
前端·javascript·react.js
江城开朗的豌豆30 分钟前
React Native 实战心得
javascript
前端小巷子31 分钟前
Vue 自定义指令
前端·vue.js·面试
玲小珑37 分钟前
Next.js 教程系列(二十七)React Server Components (RSC) 与未来趋势
前端·next.js
Mike_jia37 分钟前
UptimeRobot API状态监控:零成本打造企业级业务健康看板
前端
江城开朗的豌豆38 分钟前
React状态更新踩坑记:我是这样优雅修改参数的
前端·javascript·react.js