在学习vue3,使用vite创建项目,启动npm run dev时报错

💂 个人网站: 【紫陌】【笔记分享网】
💅 想寻找共同学习交流、共同成长的伙伴, 请点击【前端学习交流群】

运行Vue3+TS的时候报错。

failed to load config from C:\Users\PC3803\Desktop\Vue3+TS\vue3_ts_cms\vite.config.ts
error when starting dev server:
Error: The package "@esbuild/win32-x64" could not be found, and is needed by esbuild.

"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
of "package.json" is used by esbuild to install the correct binary executable
for your current platform.

报错的意思就是:

vite.config.ts加载配置失败启动开发服务器时出错:错误:无法找到@esbuild/win32-x64包,esbuild需要这个包。

解决方法:

手动运行node node_modules/esbuild/install.js来解决esbuild安装问题 安装完成之后,再次运行 npm run dev 即可 

 对你有帮助帮忙点个赞!!!

Logo

基于 Vue 的企业级 UI 组件库和中后台系统解决方案,为数万开发者服务。

更多推荐