1***@qq.com
1***@qq.com
  • 发布:2024-01-31 09:53
  • 更新:2024-01-31 09:53
  • 阅读:1195

不经意的升级,编译报错!failed to load config from D:\HBuilderX\plugins\uniapp-cli-vite\vite.config.js

分类:HBuilderX

问题描述
提示:这里描述项目中遇到的问题:

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-windows-32” package is present but this platform
needs the “esbuild-windows-64” 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.:

原因分析:
提示:这里填写问题的分析:

安装的esbuild是为不同于当前使用的平台编写的。这是因为esbuild使用了本地代码,需要安装特定平台的本机二进制可执行文件。

具体来说“esbuild-windows-64”包,但安装的是“esbuild-windows-32”包。这种情况通常发生在在Windows或macOS上安装esbuild并将“node_modules”复制到运行Linux的Docker镜像中,或者在Windows和WSL环境之间复制“node_modules”。

解决方案:
提示:这里填写该问题的具体解决方案:

1.删除HBuilderX安装目录->plugins下的uniapp-cli-vite文件夹
2.重新执行HBuilderX小程序运行流程即可

————————————————

【转载,如有侵权,请联系删除】原文链接:https://blog.csdn.net/weixin_44307574/article/details/134051695(遵循 CC 4.0 BY-SA 版权协议)

写在最后:
吃过一次HBX升级的坑,同样是编译异常,当时的解决方式是选择回退到上一个版本
【因此,我基本不会主动点击更新,这次可能是不经意点到了吧。尴尬的是前几天也是出现因为 esbuild 的问题导致编译异常,缘由是被esbuild.exe 被360杀毒查杀了,找的IT同事帮忙恢复;所以我这次同样是关机开机,异常了,网上搜了,自己解决不了也以为是电脑权限监管问题,又找了IT同事,我天,IT同事也是找了好久才找到解决方案。真是大无语了】
用的必应和百度搜索引擎,最后是必应搜出来的;
今天我用自己电脑谷歌搜一下,结果命中非常高, 还得是谷歌【怪我懒,昨天没把自己电脑拿出来查查】

0 关注 分享

要回复文章请先登录注册