npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project
- 发布:2024-05-16 15:24
- 更新:2024-05-16 15:24
- 阅读:141
产品分类: uniapp/H5
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: MacOS 14.4.1 M系列芯片
HBuilderX类型: 正式
HBuilderX版本号: 4.15
浏览器平台: Chrome
浏览器版本: 124.0.6367.207
项目创建方式: HBuilderX
操作步骤:
预期结果:
正常编译
正常编译
实际结果:
15:15:56.948 项目 my-vue3-project 开始编译
15:15:57.813 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。
15:15:57.813 vite是按需编译,运行时点击某个未编译页面会先编译后加载,导致显示较慢,发行后无此问题。
15:15:57.817 编译器版本:4.07(vue3)
15:15:57.817 正在编译中...
15:15:57.902 failed to load config from /Users/xxx/Desktop/dmeo/my-vue3-project/vite.config.ts
15:15:57.920 error when starting dev server:
15:15:57.920 Error:
15:15:57.920 You installed esbuild for another platform than the one you're currently using.
15:15:57.920 This won't work because esbuild is written with native code and needs to
15:15:57.920 install a platform-specific binary executable.
15:15:57.920 Specifically the "@esbuild/darwin-arm64" package is present but this platform
15:15:57.920 needs the "@esbuild/darwin-x64" package instead. People often get into this
15:15:57.920 situation by installing esbuild with npm running inside of Rosetta 2 and then
15:15:57.920 trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
15:15:57.920 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
15:15:57.920 If you are installing with npm, you can try ensuring that both npm and node are
15:15:57.920 not running under Rosetta 2 and then reinstalling esbuild. This likely involves
15:15:57.920 changing how you installed npm and/or node. For example, installing node with
15:15:57.920 the universal installer here should work: https://nodejs.org/en/download/. Or
15:15:57.921 you could consider using yarn instead of npm which has built-in support for
15:15:57.921 installing a package on multiple platforms simultaneously.
15:15:57.921 If you are installing with yarn, you can try listing both "arm64" and "x64"
15:15:57.921 in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
15:15:57.921 https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
15:15:57.921 Keep in mind that this means multiple copies of esbuild will be present.
15:15:57.921 Another alternative is to use the "esbuild-wasm" package instead, which works
15:15:57.921 the same way on all platforms. But it comes with a heavy performance cost and
15:15:57.921 can sometimes be 10x slower than the "esbuild" package, so you may also not
15:15:57.921 want to do that.
15:15:57.921 at generateBinPath (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:1874:17)
15:15:57.921 at esbuildCommandAndArgs (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:1955:33)
15:15:57.921 at ensureServiceIsRunning (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:2119:25)
15:15:57.921 at build (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:2011:26)
15:15:57.921 at bundleConfigFile (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:64337:26)
15:15:57.921 at loadConfigFromFile (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:64313:31)
15:15:57.921 at resolveConfig (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:63922:34)
15:15:57.921 at _createServer (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:63206:26)
15:15:57.921 at Module.createServer (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:63203:12)
15:15:57.921 at /Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/index.cjs:23:55
15:15:57.921 已停止运行...
15:15:56.948 项目 my-vue3-project 开始编译
15:15:57.813 请注意运行模式下,因日志输出、sourcemap 以及未压缩源码等原因,性能和包体积,均不及发行模式。
15:15:57.813 vite是按需编译,运行时点击某个未编译页面会先编译后加载,导致显示较慢,发行后无此问题。
15:15:57.817 编译器版本:4.07(vue3)
15:15:57.817 正在编译中...
15:15:57.902 failed to load config from /Users/xxx/Desktop/dmeo/my-vue3-project/vite.config.ts
15:15:57.920 error when starting dev server:
15:15:57.920 Error:
15:15:57.920 You installed esbuild for another platform than the one you're currently using.
15:15:57.920 This won't work because esbuild is written with native code and needs to
15:15:57.920 install a platform-specific binary executable.
15:15:57.920 Specifically the "@esbuild/darwin-arm64" package is present but this platform
15:15:57.920 needs the "@esbuild/darwin-x64" package instead. People often get into this
15:15:57.920 situation by installing esbuild with npm running inside of Rosetta 2 and then
15:15:57.920 trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
15:15:57.920 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
15:15:57.920 If you are installing with npm, you can try ensuring that both npm and node are
15:15:57.920 not running under Rosetta 2 and then reinstalling esbuild. This likely involves
15:15:57.920 changing how you installed npm and/or node. For example, installing node with
15:15:57.920 the universal installer here should work: https://nodejs.org/en/download/. Or
15:15:57.921 you could consider using yarn instead of npm which has built-in support for
15:15:57.921 installing a package on multiple platforms simultaneously.
15:15:57.921 If you are installing with yarn, you can try listing both "arm64" and "x64"
15:15:57.921 in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
15:15:57.921 https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
15:15:57.921 Keep in mind that this means multiple copies of esbuild will be present.
15:15:57.921 Another alternative is to use the "esbuild-wasm" package instead, which works
15:15:57.921 the same way on all platforms. But it comes with a heavy performance cost and
15:15:57.921 can sometimes be 10x slower than the "esbuild" package, so you may also not
15:15:57.921 want to do that.
15:15:57.921 at generateBinPath (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:1874:17)
15:15:57.921 at esbuildCommandAndArgs (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:1955:33)
15:15:57.921 at ensureServiceIsRunning (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:2119:25)
15:15:57.921 at build (/Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/esbuild/lib/main.js:2011:26)
15:15:57.921 at bundleConfigFile (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:64337:26)
15:15:57.921 at loadConfigFromFile (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:64313:31)
15:15:57.921 at resolveConfig (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:63922:34)
15:15:57.921 at _createServer (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:63206:26)
15:15:57.921 at Module.createServer (file:///Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/dist/node/chunks/dep-934dbc7c.js:63203:12)
15:15:57.921 at /Users/xxx/Desktop/dmeo/my-vue3-project/node_modules/vite/index.cjs:23:55
15:15:57.921 已停止运行...
bug描述:
按照官方示例创建Vue3/Vite cli工程:
npx degit dcloudio/uni-preset-vue#vite-ts my-vue3-project
启动H5项目时报错
0 个回复