3***@qq.com
3***@qq.com
  • 发布:2022-08-01 10:40
  • 更新:2022-08-01 11:56
  • 阅读:748

vue2升vue3运行项目报错

分类:HBuilderX

项目升级到vue3运行项目报错

10:37:58.089 failed to load config from D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\vite.config.js
10:37:58.098 error when starting dev server:
10:37:58.098 Error:
10:37:58.100 You installed esbuild on another platform than the one you're currently using.
10:37:58.101 This won't work because esbuild is written with native code and needs to
10:37:58.104 install a platform-specific binary executable.
10:37:58.107 Specifically the "esbuild-windows-32" package is present but this platform
10:37:58.112 needs the "esbuild-windows-64" package instead. People often get into this
10:37:58.114 situation by installing esbuild on Windows or macOS and copying "node_modules"
10:37:58.118 into a Docker image that runs Linux, or by copying "node_modules" between
10:37:58.122 Windows and WSL environments.
10:37:58.125 If you are installing with npm, you can try not copying the "node_modules"
10:37:58.131 directory when you copy the files over, and running "npm ci" or "npm install"
10:37:58.134 on the destination platform after the copy. Or you could consider using yarn
10:37:58.136 instead which has built-in support for installing a package on multiple
10:37:58.138 platforms simultaneously.
10:37:58.144 If you are installing with yarn, you can try listing both this platform and the
10:37:58.149 other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
10:37:58.152 feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
10:37:58.153 Keep in mind that this means multiple copies of esbuild will be present.
10:37:58.156 Another alternative is to use the "esbuild-wasm" package instead, which works
10:37:58.165 the same way on all platforms. But it comes with a heavy performance cost and
10:37:58.167 can sometimes be 10x slower than the "esbuild" package, so you may also not
10:37:58.172 want to do that.
10:37:58.179 at generateBinPath (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1788:17)
10:37:58.181 at esbuildCommandAndArgs (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1872:31)
10:37:58.187 at ensureServiceIsRunning (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:2034:25)
10:37:58.188 at Object.build (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\esbuild\lib\main.js:1927:26)
10:37:58.191 at bundleConfigFile (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-8f5c9290.js:61911:34)
10:37:58.194 at loadConfigFromFile (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-8f5c9290.js:61888:35)
10:37:58.199 at resolveConfig (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-8f5c9290.js:61415:34)
10:37:58.202 at createServer (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules\vite\dist\node\chunks\dep-8f5c9290.js:60080:26)
10:37:58.211 at createServer (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules@dcloudio\vite-plugin-uni\dist\cli\server.js:15:50)
10:37:58.217 at CAC.runDev (D:\Program Files\HBuilder\HBuilderX\plugins\uniapp-cli-vite\node_modules@dcloudio\vite-plugin-uni\dist\cli\action.js:24:45)

2022-08-01 10:40 负责人:无 分享
已邀请:
3***@qq.com

3***@qq.com (作者)

有大神知道怎么解决吗?

秦始皇二一四

秦始皇二一四

其实不太推荐vue2升级到vue3的,vue3最好是重新开项目,你可以vue3下新建项目,然后一点点拖进去

  • 3***@qq.com (作者)

    重新新建vue3项目也是报错


    2022-08-01 14:21

秦始皇二一四

秦始皇二一四

另外补充下官方的升级指南

https://ask.dcloud.net.cn/article/37834

DCloud_UNI_GSQ

DCloud_UNI_GSQ

是否在HBuilderX内配置过node?

  • 3***@qq.com (作者)

    配置过


    2022-08-01 14:20

  • 3***@qq.com (作者)

    已经解决了


    2022-08-02 13:29

  • 3***@qq.com

    回复 3***@qq.com: 请问怎么解决的,我也是引入了Element Plus,新建了一个vite.config.js后来就一直编译不了了


    2022-10-08 22:47

  • 3***@qq.com (作者)

    回复 3***@qq.com: 进入HBuilderX>plugins>uniapp-cli-vite目录下 执行 npm install esbuild-windows-64


    2022-10-25 08:39

要回复问题请先登录注册