点击hbuildx --> 运行 --> 运行到浏览器 --> 控制台报错
- 发布:2023-07-25 16:20
- 更新:2023-08-02 17:43
- 阅读:342
产品分类: HbuilderX
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 13.4.1 (c) (22F770820d)
HBuilderX版本号: 3.8.7
操作步骤:
预期结果:
点击上面的运行运行到浏览器则报错
点击上面的运行运行到浏览器则报错
实际结果:
点击上面的运行运行到浏览器则报错
点击上面的运行运行到浏览器则报错
bug描述:
是用的命令行的方式创建的vue3+vite 项目,用命令pnpm run dev和build是正常的,但是在hbuild中点击上面的运行运行到浏览器则报错:
16:13:00.321 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。
16:13:00.330 正在编译中...
16:13:00.456 failed to load config from /Users/yuanjiang/CODE/Project/paoyang-front-app/vite.config.ts
16:13:00.459 error when starting dev server:
16:13:00.459 Error:
16:13:00.465 You installed esbuild for another platform than the one you're currently using.
16:13:00.465 This won't work because esbuild is written with native code and needs to
16:13:00.467 install a platform-specific binary executable.
16:13:00.469 Specifically the "@esbuild/darwin-arm64" package is present but this platform
16:13:00.470 needs the "@esbuild/darwin-x64" package instead. People often get into this
16:13:00.471 situation by installing esbuild with npm running inside of Rosetta 2 and then
16:13:00.471 trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
16:13:00.473 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
16:13:00.474 If you are installing with npm, you can try ensuring that both npm and node are
16:13:00.475 not running under Rosetta 2 and then reinstalling esbuild. This likely involves
16:13:00.476 changing how you installed npm and/or node. For example, installing node with
16:13:00.476 the universal installer here should work: https://nodejs.org/en/download/. Or
16:13:00.478 you could consider using yarn instead of npm which has built-in support for
16:13:00.479 installing a package on multiple platforms simultaneously.
16:13:00.479 If you are installing with yarn, you can try listing both "arm64" and "x64"
16:13:00.481 in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
16:13:00.481 https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
16:13:00.483 Keep in mind that this means multiple copies of esbuild will be present.
16:13:00.483 Another alternative is to use the "esbuild-wasm" package instead, which works
16:13:00.485 the same way on all platforms. But it comes with a heavy performance cost and
16:13:00.486 can sometimes be 10x slower than the "esbuild" package, so you may also not
16:13:00.486 want to do that.
16:13:00.488 at generateBinPath (/Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/esbuild/lib/main.js:1841:17)
16:13:00.489 at esbuildCommandAndArgs (/Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/esbuild/lib/main.js:1922:33)
16:13:00.491 at ensureServiceIsRunning (/Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/esbuild/lib/main.js:2087:25)
16:13:00.491 at build (/Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/esbuild/lib/main.js:1978:26)
16:13:00.493 at bundleConfigFile (file:///Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62245:26)
16:13:00.495 at loadConfigFromFile (file:///Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:62221:31)
16:13:00.496 at resolveConfig (file:///Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:61843:34)
16:13:00.497 at Module.createServer (file:///Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/vite/dist/node/chunks/dep-ca21228b.js:61153:26)
16:13:00.499 at /Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/vite/index.cjs:23:55
16:13:00.499 at async createServer (/Users/yuanjiang/CODE/Project/paoyang-front-app/node_modules/@dcloudio/vite-plugin-uni/dist/cli/server.js:44:20)