我是靠谱客的博主 单纯服饰,最近开发中收集的这篇文章主要介绍hbuilderX运行Vue3/Vite版项目报错 error during build 解决方法,觉得挺不错的,现在分享给大家,希望可以做个参考。
概述
m1 pro编译 vite/vue3 cli项目时编译报错
错误详情:
15:14:13.762 项目 'fcbmallwx' 开始编译...
15:14:14.766 编译器版本:3.5.3(vue3)
15:14:14.769 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。
15:14:14.770 正在编译中...
15:14:14.774 failed to load config from /Users/xxx/uni-preset-vue/vite.config.js
15:14:14.777 error during build:
15:14:14.779 Error:
15:14:14.780 You installed esbuild on another platform than the one you're currently using.
15:14:14.782 This won't work because esbuild is written with native code and needs to
15:14:14.783 install a platform-specific binary executable.
15:14:14.791 Specifically the "esbuild-darwin-arm64" package is present but this platform
15:14:14.791 needs the "esbuild-darwin-64" package instead. People often get into this
15:14:14.794 situation by installing esbuild on Windows or macOS and copying "node_modules"
15:14:14.796 into a Docker image that runs Linux, or by copying "node_modules" between
15:14:14.797 Windows and WSL environments.
15:14:14.799 If you are installing with npm, you can try not copying the "node_modules"
15:14:14.801 directory when you copy the files over, and running "npm ci" or "npm install"
15:14:14.803 on the destination platform after the copy. Or you could consider using yarn
15:14:14.803 instead which has built-in support for installing a package on multiple
15:14:14.805 platforms simultaneously.
15:14:14.807 If you are installing with yarn, you can try listing both this platform and the
15:14:14.814 other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
15:14:14.814 feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
15:14:14.818 Keep in mind that this means multiple copies of esbuild will be present.
15:14:14.820 Another alternative is to use the "esbuild-wasm" package instead, which works
15:14:14.822 the same way on all platforms. But it comes with a heavy performance cost and
15:14:14.823 can sometimes be 10x slower than the "esbuild" package, so you may also not
15:14:14.825 want to do that.
解决方法:
-
pnpm 安装的话到这个文件
node_modules/.pnpm/esbuild@0.14.51/node_modules/esbuild-darwin-arm64
复制 esbuild-darwin-arm64 文件夹在同级目录下改名为esbuild-darwin-64
即可
-
npm 或 yarn安装的话到 node_modules 目录复制
esbuild-darwin-arm64
文件夹改名为esbuild-darwin-64
即可
esbuild-darwin-64 和 esbuild-darwin-arm64 两个文件夹都需要
问题原因:
推测是 vite 用 esbuild 编译时 hbuilderX 里面默认去找 esbuild-darwin-64
文件夹, 但是 m1 是 arm 架构下载到包是 esbuild-darwin-arm64
导致找不到对应的编译包就报错了
最后
以上就是单纯服饰为你收集整理的hbuilderX运行Vue3/Vite版项目报错 error during build 解决方法的全部内容,希望文章能够帮你解决hbuilderX运行Vue3/Vite版项目报错 error during build 解决方法所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复