1.下载并安装小程序开发者工具。 微信开发者工具:[下载地址](https://developers.weixin.qq.com/miniprogram/dev/devtools/download.html) 2.打开HBuilderX,【工具】-【设置】-【运行设置】,找到小程序运行配置,设置好微信开发工具路径。 ![](https://git.kancloud.cn/repos/yi_xiang_42/likeshop_develop_v2_x/raw/1b0a40473e5d0b763167a1c082331dc9be1d1854/images/WX20210222-2152212x.png?access-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjQ5MjcxMzAsImlhdCI6MTYyNDg4MzkzMCwicmVwb3NpdG9yeSI6InlpX3hpYW5nXzQyXC9saWtlc2hvcF9kZXZlbG9wX3YyX3giLCJ1c2VyIjp7InVzZXJuYW1lIjoiaW5kZXhsaW4iLCJuYW1lIjoiaW5kZXhsaW4iLCJlbWFpbCI6ImluZGV4bGluQHFxLmNvbSIsInRva2VuIjoiOWUwOTNhNGYzYWIzMjQ2ZGY4YmZiYzRlNzgwMWUxNDIiLCJhdXRob3JpemUiOnsicHVsbCI6dHJ1ZSwicHVzaCI6dHJ1ZSwiYWRtaW4iOnRydWV9fX0.Z74JV7TLoQT6QhSyPjDeLqnn0fayo4wsh9dKC8nwU4s) 3.打开微信开发者工具,点击设置图标、找到安全项、开启服务端口。 ![](https://git.kancloud.cn/repos/yi_xiang_42/likeshop_develop_v2_x/raw/1b0a40473e5d0b763167a1c082331dc9be1d1854/images/WX20210222-2154052x.png?access-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjQ5MjcxMzAsImlhdCI6MTYyNDg4MzkzMCwicmVwb3NpdG9yeSI6InlpX3hpYW5nXzQyXC9saWtlc2hvcF9kZXZlbG9wX3YyX3giLCJ1c2VyIjp7InVzZXJuYW1lIjoiaW5kZXhsaW4iLCJuYW1lIjoiaW5kZXhsaW4iLCJlbWFpbCI6ImluZGV4bGluQHFxLmNvbSIsInRva2VuIjoiOWUwOTNhNGYzYWIzMjQ2ZGY4YmZiYzRlNzgwMWUxNDIiLCJhdXRob3JpemUiOnsicHVsbCI6dHJ1ZSwicHVzaCI6dHJ1ZSwiYWRtaW4iOnRydWV9fX0.Z74JV7TLoQT6QhSyPjDeLqnn0fayo4wsh9dKC8nwU4s) 4.打开likeshopv2/uniapp/config/app.js,设置好小程序请求的接口域名。 ![](https://git.kancloud.cn/repos/yi_xiang_42/likeshop_develop_v2_x/raw/1b0a40473e5d0b763167a1c082331dc9be1d1854/images/WX20210223-1032522x.png?access-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjQ5MjcxMzAsImlhdCI6MTYyNDg4MzkzMCwicmVwb3NpdG9yeSI6InlpX3hpYW5nXzQyXC9saWtlc2hvcF9kZXZlbG9wX3YyX3giLCJ1c2VyIjp7InVzZXJuYW1lIjoiaW5kZXhsaW4iLCJuYW1lIjoiaW5kZXhsaW4iLCJlbWFpbCI6ImluZGV4bGluQHFxLmNvbSIsInRva2VuIjoiOWUwOTNhNGYzYWIzMjQ2ZGY4YmZiYzRlNzgwMWUxNDIiLCJhdXRob3JpemUiOnsicHVsbCI6dHJ1ZSwicHVzaCI6dHJ1ZSwiYWRtaW4iOnRydWV9fX0.Z74JV7TLoQT6QhSyPjDeLqnn0fayo4wsh9dKC8nwU4s) 5.打开【发行】-【小程序-微信】,填写小程序名称,设置小程序AppId,点击发行。 ![](https://git.kancloud.cn/repos/yi_xiang_42/likeshop_develop_v2_x/raw/1b0a40473e5d0b763167a1c082331dc9be1d1854/images/WX20210223-1035102x.png?access-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjQ5MjcxMzAsImlhdCI6MTYyNDg4MzkzMCwicmVwb3NpdG9yeSI6InlpX3hpYW5nXzQyXC9saWtlc2hvcF9kZXZlbG9wX3YyX3giLCJ1c2VyIjp7InVzZXJuYW1lIjoiaW5kZXhsaW4iLCJuYW1lIjoiaW5kZXhsaW4iLCJlbWFpbCI6ImluZGV4bGluQHFxLmNvbSIsInRva2VuIjoiOWUwOTNhNGYzYWIzMjQ2ZGY4YmZiYzRlNzgwMWUxNDIiLCJhdXRob3JpemUiOnsicHVsbCI6dHJ1ZSwicHVzaCI6dHJ1ZSwiYWRtaW4iOnRydWV9fX0.Z74JV7TLoQT6QhSyPjDeLqnn0fayo4wsh9dKC8nwU4s) ![](https://git.kancloud.cn/repos/yi_xiang_42/likeshop_develop_v2_x/raw/1b0a40473e5d0b763167a1c082331dc9be1d1854/images/WX20210223-1036152x.png?access-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjQ5MjcxMzAsImlhdCI6MTYyNDg4MzkzMCwicmVwb3NpdG9yeSI6InlpX3hpYW5nXzQyXC9saWtlc2hvcF9kZXZlbG9wX3YyX3giLCJ1c2VyIjp7InVzZXJuYW1lIjoiaW5kZXhsaW4iLCJuYW1lIjoiaW5kZXhsaW4iLCJlbWFpbCI6ImluZGV4bGluQHFxLmNvbSIsInRva2VuIjoiOWUwOTNhNGYzYWIzMjQ2ZGY4YmZiYzRlNzgwMWUxNDIiLCJhdXRob3JpemUiOnsicHVsbCI6dHJ1ZSwicHVzaCI6dHJ1ZSwiYWRtaW4iOnRydWV9fX0.Z74JV7TLoQT6QhSyPjDeLqnn0fayo4wsh9dKC8nwU4s) 6.编译完成以后,小程序开发者工具会自动打开,如果小程序运行不正常,设置调试基础版本为2.9.5,然后再编译。 ![](https://git.kancloud.cn/repos/yi_xiang_42/likeshop_develop_v2_x/raw/1b0a40473e5d0b763167a1c082331dc9be1d1854/images/WechatIMG342.png?access-token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MjQ5MjcxMzAsImlhdCI6MTYyNDg4MzkzMCwicmVwb3NpdG9yeSI6InlpX3hpYW5nXzQyXC9saWtlc2hvcF9kZXZlbG9wX3YyX3giLCJ1c2VyIjp7InVzZXJuYW1lIjoiaW5kZXhsaW4iLCJuYW1lIjoiaW5kZXhsaW4iLCJlbWFpbCI6ImluZGV4bGluQHFxLmNvbSIsInRva2VuIjoiOWUwOTNhNGYzYWIzMjQ2ZGY4YmZiYzRlNzgwMWUxNDIiLCJhdXRob3JpemUiOnsicHVsbCI6dHJ1ZSwicHVzaCI6dHJ1ZSwiYWRtaW4iOnRydWV9fX0.Z74JV7TLoQT6QhSyPjDeLqnn0fayo4wsh9dKC8nwU4s)