Vite构建的前端项目在执行 "npm run dev" 命令时报错 "failed to load vite.config.ts"

报错信息:

Failed to load config from xx/.../xx/vite.config.ts error during build:
Error:

You installed esbuild for another platform than the one you're currently using.
This won't work because esbuild is written with native code and needs to install a
platform-specific binary executable.

Specifically the "@esbuild/darwin-x64" package is present but this platform needs
the "@esbuild/darwin-x64" package instead. ......

 

解决方案:

1. 删除项目本地的 node_modules,然后重新安装,问题解决(优先推荐);
2. 网上其他版本的处理方案:检查 ~/. vscode/extensions 文件夹,然后安装 @esbuild/darwin-x64;

posted @ 2024-03-13 20:57  樊顺  阅读(2369)  评论(0编辑  收藏  举报