我使用命令行编译微信小程序,node.js版本16,dcloud包升级至最新版。使用vue3.
运行
npm run build:mp-weixin
时报错:
Error: Vue3 项目暂不支持当前小程序
(base) (base) chris@ChrisdeMacBook-Air frontend % npm ru
n build:mp-weixin
> chatgallery_v3@0.1.0 build:mp-weixin
> cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build
There are differences in the implementation mechanism of the browser kernels and custom components of each mini-program, and there may be compatibility issues with styles and layouts, please refer to: https://uniapp.dcloud.io/matter?id=mp
✔ Start to compile the current project to the mp-weixin platform...
ERROR Error: Vue3 项目暂不支持当前小程序
Error: Vue3 项目暂不支持当前小程序
at Object.getMPRuntimePath (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/uni-cli-shared/lib/platform.js:152:15)
at Object.<anonymous> (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/webpack-uni-mp-loader/lib/plugin/generate-component.js:24:80)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Module.require (node:internal/modules/cjs/loader:1100:19)
at require (node:internal/modules/cjs/helpers:119:18)
at Object.<anonymous> (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/webpack-uni-mp-loader/lib/plugin/index-new.js:17:27)
at Module._compile (node:internal/modules/cjs/loader:1198:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
at Module.load (node:internal/modules/cjs/loader:1076:32)
at Function.Module._load (node:internal/modules/cjs/loader:911:12)
at Module.require (node:internal/modules/cjs/loader:1100:19)
at require (node:internal/modules/cjs/helpers:119:18)
at createUniMPPlugin (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/vue-cli-plugin-uni/lib/mp/index.js:26:30)
at webpackConfig (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/vue-cli-plugin-uni/lib/mp/index.js:193:7)
at /Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/vue-cli-plugin-uni/lib/configure-webpack.js:183:31
at /Users/chris/development/ChatGallery/frontend/node_modules/@vue/cli-service/lib/Service.js:283:21
at Array.forEach (<anonymous>)
at Service.resolveWebpackConfig (/Users/chris/development/ChatGallery/frontend/node_modules/@vue/cli-service/lib/Service.js:280:30)
at PluginAPI.resolveWebpackConfig (/Users/chris/development/ChatGallery/frontend/node_modules/@vue/cli-service/lib/PluginAPI.js:132:25)
at module.exports (/Users/chris/development/ChatGallery/frontend/node_modules/@vue/cli-service/lib/commands/build/resolveAppConfig.js:51:14)
at getWebpackConfig (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:89:88)
at getWebpackConfigs (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:122:13)
at build (/Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:161:26)
at /Users/chris/development/ChatGallery/frontend/node_modules/@dcloudio/vue-cli-plugin-uni/commands/build.js:80:11
at Service.run (/Users/chris/development/ChatGallery/frontend/node_modules/@vue/cli-service/lib/Service.js:262:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
3 个回复
最佳回复
DCloud_UNI_FengXY
通过cli创建vue3项目,必须用npx degit dcloudio/uni-preset-vue#vite my-vue3-project命令创建,详情:https://uniapp.dcloud.net.cn/quickstart-cli.html#%E5%88%9B%E5%BB%BAuni-app,vue2和vue3的cli命令不同,不能把一个使用vue2命令创建的项目通过修改manifest.json直接变成vue3.
HBuilderX创建的项目vue2和vue3运行的也是不同的编译器插件,不能用vue2的编译器(uniapp-cli)插件来运行vue3,vue3对应的编译器插件是(uniapp-cli-vite)
DCloud_UNI_OttoJi - 日常回复 uni-app/x 问题,如果艾特我没看到,请主动私信
使用 npx @dcloudio/uvm@latest alpha 重新试试,可能当时正在发版,如果仍有问题请开新贴解决,并提供复现工程说明依赖版本。
6***@qq.com
我今天也遇到了,我是从vscode插件运行的。
2025-03-15 17:42:01.874 [info] Node path: D:\KF\HBuilderX\plugins\node\node
2025-03-15 17:42:01.874 [info] Node env: {"NODE_ENV":"development","UNI_PLATFORM":"mp-weixin","UNI_INPUT_DIR":"D:/Project/IdeaProjects/小程序/hotel-mini-program-testing/groggery/src","UNI_OUTPUT_DIR":"D:\Project\IdeaProjects\小程序\hotel-mini-program-testing\groggery\src\unpackage\dist\dev\mp-weixin","UNI_MINIMIZE":"false"}
2025-03-15 17:42:01.874 [info] Node args: []
2025-03-15 17:42:02.584 [info] Please note that in running mode, due to log output, sourcemap, and uncompressed source code, the performance and package size are not as good as release mode.To officially release, please click the release menu or use the cli release command to release
2025-03-15 17:42:02.587 [info] There are differences in the implementation mechanism of the browser kernels and custom components of each mini-program, and there may be compatibility issues with styles and layouts, please refer to: https://uniapp.dcloud.io/matter?id=mp
Compiling...
2025-03-15 17:42:03.054 [info]
2025-03-15 17:42:03.743 [error] ERROR Error: Vue3 项目暂不支持当前小程序
Error: Vue3 项目暂不支持当前小程序
at Object.getMPRuntimePath (D:\KF\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\uni-cli-shared\lib\platform.js:161:15)
at Object.<anonymous> (D:\KF\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\webpack-uni-mp-loader\lib\plugin\generate-component.js:24:80)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (D:\KF\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\webpack-uni-mp-loader\lib\plugin\index-new.js:17:27)
at Module._compile (node:internal/modules/cjs/loader:1364:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at Module.require (node:internal/modules/cjs/loader:1231:19)
at require (node:internal/modules/helpers:177:18)
at createUniMPPlugin (D:\KF\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\vue-cli-plugin-uni\lib\mp\index.js:27:30)
2025-03-15 17:42:03.756 [info] uniapp-run process exit with code 1
2025-03-15 17:42:03.756 [info] uniapp-run process stop ....