failed to load config from D:\朗慧\digital-welcome-project\vite.config.ts error when starting dev server: 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/win32-x64" package is present but this platform needs the "@esbuild/win32-ia32" package instead. People often get into this situation by installing esbuild on Windows or macOS and copying "node_modules" into a Docker image that runs Linux, or by copying "node_modules" between Windows and WSL environments. If you are installing with npm, you can try not copying the "node_modules" directory when you copy the files over, and running "npm ci" or "npm install" on the destination platform after the copy. Or you could consider using yarn instead of npm which has built-in support for installing a package on multiple platforms simultaneously. If you are installing with yarn, you can try listing both this platform and the other platform in your ".yarnrc.yml" file using the "supportedArchitectures" feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures Keep in mind that this means multiple copies of esbuild will be present. Another alternative is to use the "esbuild-wasm" package instead, which works the same way on all platforms. But it comes with a heavy performance cost and can sometimes be 10x slower than the "esbuild" package, so you may also not want to do that.
时间: 2024-04-26 20:26:46 浏览: 255
全栈-Vite3+Vue3+TS+Ant-design-vue3整合
这个错误的意思是你在启动开发服务器时遇到了一个错误:无法从 D:\朗慧\digital-welcome-project\vite.config.ts 加载配置。报错的原因是:你在当前平台上安装的 esbuild 与你正在使用的平台不匹配。esbuild 是用本地代码编写的,并且需要安装特定于平台的二进制可执行文件。具体来说,"@esbuild/win32-x64" 包存在,但这个平台需要 "@esbuild/win32-ia32" 包。人们通常会通过在 Windows 或 macOS 上安装 esbuild,然后将 "node_modules" 目录复制到运行 Linux 的 Docker 镜像中,或者在 Windows 和 WSL 环境之间复制 "node_modules" 目录来陷入这种情况。如果你使用 npm 安装,可以尝试在复制文件时不复制 "node_modules" 目录,并在复制后的目标平台上运行 "npm ci" 或 "npm install"。或者你可以考虑使用内置支持同时在多个平台上安装包的 yarn 替代 npm。如果你使用 yarn 安装,可以尝试使用 "supportedArchitectures" 功能在你的 ".yarnrc.yml" 文件中列出这个平台和其他平台:https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures 请注意,这意味着 esbuild 的多个副本将存在。另一种选择是使用 "esbuild-wasm" 包,它在所有平台上都工作方式相同。但它的性能成本很高,有时比 "esbuild" 包慢 10 倍,所以你可能也不想这样做。
阅读全文