uni-app 编译 微信小程序插件报错

rfbsl7qr  于 7个月前  发布在  uni-app
关注(0)|答案(1)|浏览(195)

问题描述
[问题描述:尽可能简洁清晰地把问题描述清楚]
https://uniapp.dcloud.net.cn/tutorial/mp-weixin-plugin-dev.html 按照官网进行微信小程序插件开发,执行命令行构建,HBuild 只能运行小程序,这里使用命令行运行,构建报错

复现步骤
[复现问题的步骤]

  1. 启动 安装 @dcloudio/uvm 全局安装成功 node: v18.7.0 (npm v8.15.0) npm i @dcloudio/uvm -g
  2. 添加 script 构建脚本 "dev:mp-wx-plugin": "yarn dev:custom mp-wx-plugin --plugin"
  3. 命令行执行命令 npm run dev:mp-wx-plugin

预期结果

正常构建

实际结果

  1. > yarn dev:mp-weixin mp-wx-plugin --plugin
  2. yarn run v1.22.19
  3. error Command "dev:mp-weixin" not found.
  4. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

系统信息:

  • 发行平台: [如 微信小程序、H5平台、5+ App等] 微信小程序
  • 操作系统 [如 iOS 12.1.2、Android 7.0] 无
  • HBuilderX版本 [如使用HBuilderX,则需提供 HBuilderX 版本号] 3.6.4.20220922
  • uni-app版本 [如使用Vue-cli创建/运行项目,则提供 npm run info 的运行结果]
  • 设备信息 [如 iPhone8 Plus]
  1. yarn run v1.22.19
  2. error Command "dev:mp-weixin" not found.
  3. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

补充信息
[可选]
[根据你的分析,出现这个问题的原因可能在哪里?]

uni-app 配置了 mp-wx-plugin
yarn dev:custom mp-wx-plugin --plugin 是否是 dev:custom 要改成 dev:mp-weixin, 但是修改后也没有用

  1. {
  2. "name": "chat-web-uniapp",
  3. "version": "1.0.0",
  4. "description": "",
  5. "main": "main.js",
  6. "scripts": {
  7. "dev:mp-wx-plugin": "yarn dev:custom mp-wx-plugin --plugin"
  8. },
  9. "uni-app": {
  10. "scripts": {
  11. "mp-wx-plugin": {
  12. "title": "微信小程序插件",
  13. "env": {
  14. "UNI_PLATFORM": "mp-weixin"
  15. },
  16. "define": {
  17. "MP-WX-PLUGIN": true
  18. }
  19. }
  20. }
  21. },
  22. "repository": {
  23. "type": "git",
  24. "url": "",
  25. },
  26. "author": "",
  27. "license": "MIT",
  28. "dependencies": {
  29. "axios": "^1.1.3",
  30. }
  31. }
wlwcrazw

wlwcrazw1#

你好,请问解决了吗,我也遇到了这个问题

相关问题