dcloudio / uni-app

A cross-platform framework using Vue.js
https://uniapp.dcloud.io
Apache License 2.0
40.17k stars 3.64k forks source link

编译 微信小程序插件报错 #3985

Open hitao123 opened 2 years ago

hitao123 commented 2 years ago

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

image

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

  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

预期结果

正常构建

实际结果

> yarn dev:mp-weixin mp-wx-plugin --plugin

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

系统信息:

yarn run v1.22.19
error Command "dev:mp-weixin" not found.
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, 但是修改后也没有用

{
  "name": "chat-web-uniapp",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "dev:mp-wx-plugin": "yarn dev:custom mp-wx-plugin --plugin"
  },
  "uni-app": {
    "scripts": {
      "mp-wx-plugin": {
        "title": "微信小程序插件",
        "env": {
          "UNI_PLATFORM": "mp-weixin"
        },
        "define": {
          "MP-WX-PLUGIN": true
        }
      }
    }
  },
  "repository": {
    "type": "git",
    "url": "",
  },
  "author": "",
  "license": "MIT",
  "dependencies": {
    "axios": "^1.1.3",
  }
}
Ghostofcommunismm commented 5 months ago

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