- 发布:2024-03-17 03:18
- 更新:2024-03-17 03:18
- 阅读:477
产品分类: HbuilderX
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: macOS Sonoma 14.4 (23E214)
HBuilderX类型: 正式
HBuilderX版本号: 3.99
手机系统: 全部
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
操作步骤:
从 HBuilder X 新建的项目,未做任何代码改动,真机调试 和 云打包 都会报错。
从 HBuilder X 新建的项目,未做任何代码改动,真机调试 和 云打包 都会报错。
预期结果:
期望正常调试 与 打包
期望正常调试 与 打包
实际结果:
调试 与 打包 均为报错
真机调试报错:
[广告] 02:49:25.112 uni-cdn,帮你节省至少30%的 CDN 费用!详情
02:49:25.131 项目 'uniapp-hello' 开始编译...
02:49:25.834 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。
02:49:25.836 编译器版本:3.8.12(vue3)
02:49:25.837 正在编译中...
02:49:25.920 failed to load config from /Users/helloworld/project/uniapp/uniapp-hello/vite.config.ts
02:49:25.922 error during build:
02:49:25.923 Error:
02:49:25.926 You installed esbuild for another platform than the one you're currently using.
02:49:25.926 This won't work because esbuild is written with native code and needs to
02:49:25.927 install a platform-specific binary executable.
02:49:25.929 Specifically the "@esbuild/darwin-arm64" package is present but this platform
02:49:25.929 needs the "@esbuild/darwin-x64" package instead. People often get into this
02:49:25.930 situation by installing esbuild with npm running inside of Rosetta 2 and then
02:49:25.930 trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
02:49:25.932 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
02:49:25.932 If you are installing with npm, you can try ensuring that both npm and node are
02:49:25.938 not running under Rosetta 2 and then reinstalling esbuild. This likely involves
02:49:25.938 changing how you installed npm and/or node. For example, installing node with
02:49:25.940 the universal installer here should work: https://nodejs.org/en/download/. Or
02:49:25.941 you could consider using yarn instead of npm which has built-in support for
02:49:25.942 installing a package on multiple platforms simultaneously.
02:49:25.943 If you are installing with yarn, you can try listing both "arm64" and "x64"
02:49:25.945 in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
02:49:25.945 https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
02:49:25.946 Keep in mind that this means multiple copies of esbuild will be present.
02:49:25.946 Another alternative is to use the "esbuild-wasm" package instead, which works
02:49:25.948 the same way on all platforms. But it comes with a heavy performance cost and
02:49:25.949 can sometimes be 10x slower than the "esbuild" package, so you may also not
02:49:25.950 want to do that.
02:49:25.950 at generateBinPath (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1841:17)
02:49:25.952 at esbuildCommandAndArgs (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1922:33)
02:49:25.953 at ensureServiceIsRunning (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:2087:25)
02:49:25.955 at build (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1978:26)
02:49:25.955 at bundleConfigFile (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62245:26)
02:49:25.957 at loadConfigFromFile (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62221:31)
02:49:25.958 at resolveConfig (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:61843:34)
02:49:25.958 at Module.build (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:44512:26)
02:49:25.960 at /Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/index.cjs:23:55
02:49:25.962 at async buildApp (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/@dcloudio+vite-plugin-uni@3.0.0-3081220230817001_postcss@8.4.35_vite@4.1.4_vue@3.4.21/node_modules/@dcloudio/vite-plugin-uni/dist/cli/build.js:121:24)
02:59:26.249 已停止运行...
云打包报错:
[HBuilder] 02:44:26.641 failed to load config from /Users/helloworld/project/uniapp/uniapp-hello/vite.config.ts
[HBuilder] 02:44:26.643 Build failed with errors.
调试 与 打包 均为报错
真机调试报错:
[广告] 02:49:25.112 uni-cdn,帮你节省至少30%的 CDN 费用!详情
02:49:25.131 项目 'uniapp-hello' 开始编译...
02:49:25.834 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。
02:49:25.836 编译器版本:3.8.12(vue3)
02:49:25.837 正在编译中...
02:49:25.920 failed to load config from /Users/helloworld/project/uniapp/uniapp-hello/vite.config.ts
02:49:25.922 error during build:
02:49:25.923 Error:
02:49:25.926 You installed esbuild for another platform than the one you're currently using.
02:49:25.926 This won't work because esbuild is written with native code and needs to
02:49:25.927 install a platform-specific binary executable.
02:49:25.929 Specifically the "@esbuild/darwin-arm64" package is present but this platform
02:49:25.929 needs the "@esbuild/darwin-x64" package instead. People often get into this
02:49:25.930 situation by installing esbuild with npm running inside of Rosetta 2 and then
02:49:25.930 trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
02:49:25.932 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
02:49:25.932 If you are installing with npm, you can try ensuring that both npm and node are
02:49:25.938 not running under Rosetta 2 and then reinstalling esbuild. This likely involves
02:49:25.938 changing how you installed npm and/or node. For example, installing node with
02:49:25.940 the universal installer here should work: https://nodejs.org/en/download/. Or
02:49:25.941 you could consider using yarn instead of npm which has built-in support for
02:49:25.942 installing a package on multiple platforms simultaneously.
02:49:25.943 If you are installing with yarn, you can try listing both "arm64" and "x64"
02:49:25.945 in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
02:49:25.945 https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
02:49:25.946 Keep in mind that this means multiple copies of esbuild will be present.
02:49:25.946 Another alternative is to use the "esbuild-wasm" package instead, which works
02:49:25.948 the same way on all platforms. But it comes with a heavy performance cost and
02:49:25.949 can sometimes be 10x slower than the "esbuild" package, so you may also not
02:49:25.950 want to do that.
02:49:25.950 at generateBinPath (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1841:17)
02:49:25.952 at esbuildCommandAndArgs (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1922:33)
02:49:25.953 at ensureServiceIsRunning (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:2087:25)
02:49:25.955 at build (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1978:26)
02:49:25.955 at bundleConfigFile (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62245:26)
02:49:25.957 at loadConfigFromFile (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62221:31)
02:49:25.958 at resolveConfig (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:61843:34)
02:49:25.958 at Module.build (file:///Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/dist/node/chunks/dep-ca21228b.js:44512:26)
02:49:25.960 at /Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/vite@4.1.4_terser@5.29.2/node_modules/vite/index.cjs:23:55
02:49:25.962 at async buildApp (/Users/helloworld/project/uniapp/uniapp-hello/node_modules/.pnpm/@dcloudio+vite-plugin-uni@3.0.0-3081220230817001_postcss@8.4.35_vite@4.1.4_vue@3.4.21/node_modules/@dcloudio/vite-plugin-uni/dist/cli/build.js:121:24)
02:59:26.249 已停止运行...
云打包报错:
[HBuilder] 02:44:26.641 failed to load config from /Users/helloworld/project/uniapp/uniapp-hello/vite.config.ts
[HBuilder] 02:44:26.643 Build failed with errors.
bug描述:
使用 2024 款 Macbook Air 电脑,进行项目真机调试 与 云打包都出现报错。
要如何配置啊,M芯片电脑问题好严重。。。
搞了好久也没找到方法处理,还蛮耽误项目进度!
⚠️注:从 HBuilder X 新建的项目,未做任何代码改动,依然打包报错。
官方,求帮转解决!!