9***@qq.com
9***@qq.com
  • 发布:2024-04-04 21:42
  • 更新:2024-04-05 17:50
  • 阅读:73

【报Bug】cli项目MAC m1 启动项目报错,命令启动没有问题

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Mac

PC开发环境操作系统版本号: 4.08

HBuilderX类型: 正式

HBuilderX版本号: 4.08

第三方开发者工具版本号: 1.06.2402040

基础库版本号: 3.3.3

项目创建方式: HBuilderX

示例代码:

:09.646 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布
12:07:09.659 正在编译中...
12:07:09.834 failed to load config from /Users/dalong/Documents/HBuilderProjects/uniapp-vue3/vite.config.js
12:07:09.850 error during build:
12:07:09.852 Error:
12:07:09.863 You installed esbuild for another platform than the one you're currently using.
12:07:09.880 This won't work because esbuild is written with native code and needs to
12:07:09.894 install a platform-specific binary executable.
12:07:09.909 Specifically the "@esbuild/darwin-arm64" package is present but this platform
12:07:09.911 needs the "@esbuild/darwin-x64" package instead. People often get into this
12:07:09.940 situation by installing esbuild with npm running inside of Rosetta 2 and then
12:07:09.956 trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
12:07:09.969 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
12:07:09.971 If you are installing with npm, you can try ensuring that both npm and node are
12:07:09.984 not running under Rosetta 2 and then reinstalling esbuild. This likely involves
12:07:09.987 changing how you installed npm and/or node. For example, installing node with
12:07:10.001 the universal installer here should work: https://nodejs.org/en/download/. Or
12:07:10.003 you could consider using yarn instead of npm which has built-in support for
12:07:10.017 installing a package on multiple platforms simultaneously.
12:07:10.019 If you are installing with yarn, you can try listing both "arm64" and "x64"
12:07:10.033 in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
12:07:10.036 https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
12:07:10.051 Keep in mind that this means multiple copies of esbuild will be present.
12:07:10.053 Another alternative is to use the "esbuild-wasm" package instead, which works
12:07:10.068 the same way on all platforms. But it comes with a heavy performance cost and
12:07:10.070 can sometimes be 10x slower than the "esbuild" package, so you may also not
12:07:10.086 want to do that.
12:07:10.102 at generateBinPath (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1841:17)
12:07:10.117 at esbuildCommandAndArgs (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1922:33)
12:07:10.133 at ensureServiceIsRunning (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:2087:25)
12:07:10.149 at build (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1978:26)
12:07:10.166 at bundleConfigFile (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:61966:26)
12:07:10.183 at loadConfigFromFile (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:61942:31)
12:07:10.185 at resolveConfig (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:61564:34)
12:07:10.203 at doBuild (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:44332:26)
12:07:10.221 at Module.build (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:44321:22)
12:07:10.239 at /Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/index.cjs:23:55

操作步骤:

使用工具里面的运行-运行到小程序模拟器-微信开发者工具

预期结果:

正常启动小程序

实际结果:

报错

bug描述:

:09.646 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。若要正式发布,请点击发行菜单或使用 cli 发布命令进行发布
12:07:09.659 正在编译中...
12:07:09.834 failed to load config from /Users/dalong/Documents/HBuilderProjects/uniapp-vue3/vite.config.js
12:07:09.850 error during build:
12:07:09.852 Error:
12:07:09.863 You installed esbuild for another platform than the one you're currently using.
12:07:09.880 This won't work because esbuild is written with native code and needs to
12:07:09.894 install a platform-specific binary executable.
12:07:09.909 Specifically the "@esbuild/darwin-arm64" package is present but this platform
12:07:09.911 needs the "@esbuild/darwin-x64" package instead. People often get into this
12:07:09.940 situation by installing esbuild with npm running inside of Rosetta 2 and then
12:07:09.956 trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
12:07:09.969 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
12:07:09.971 If you are installing with npm, you can try ensuring that both npm and node are
12:07:09.984 not running under Rosetta 2 and then reinstalling esbuild. This likely involves
12:07:09.987 changing how you installed npm and/or node. For example, installing node with
12:07:10.001 the universal installer here should work: https://nodejs.org/en/download/. Or
12:07:10.003 you could consider using yarn instead of npm which has built-in support for
12:07:10.017 installing a package on multiple platforms simultaneously.
12:07:10.019 If you are installing with yarn, you can try listing both "arm64" and "x64"
12:07:10.033 in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
12:07:10.036 https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
12:07:10.051 Keep in mind that this means multiple copies of esbuild will be present.
12:07:10.053 Another alternative is to use the "esbuild-wasm" package instead, which works
12:07:10.068 the same way on all platforms. But it comes with a heavy performance cost and
12:07:10.070 can sometimes be 10x slower than the "esbuild" package, so you may also not
12:07:10.086 want to do that.
12:07:10.102 at generateBinPath (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1841:17)
12:07:10.117 at esbuildCommandAndArgs (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1922:33)
12:07:10.133 at ensureServiceIsRunning (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:2087:25)
12:07:10.149 at build (/Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/esbuild@0.16.17/node_modules/esbuild/lib/main.js:1978:26)
12:07:10.166 at bundleConfigFile (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:61966:26)
12:07:10.183 at loadConfigFromFile (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:61942:31)
12:07:10.185 at resolveConfig (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:61564:34)
12:07:10.203 at doBuild (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:44332:26)
12:07:10.221 at Module.build (file:///Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/dist/node/chunks/dep-0bae2027.js:44321:22)
12:07:10.239 at /Users/dalong/Documents/HBuilderProjects/uniapp-vue3/node_modules/.store/vite@4.0.3/node_modules/vite/index.cjs:23:55

cli项目,运行报这个错,m1芯片,用命令启动没有问题

2024-04-04 21:42 负责人:无 分享
已邀请:
m***@qq.com

m***@qq.com

我也遇到了

要回复问题请先登录注册