Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create a Wechaty Token Gateway for Puppet XP #38

Open
huan opened this issue Oct 26, 2021 · 28 comments
Open

How to create a Wechaty Token Gateway for Puppet XP #38

huan opened this issue Oct 26, 2021 · 28 comments
Labels
documentation Improvements or additions to documentation

Comments

@huan
Copy link
Member

huan commented Oct 26, 2021

Update Jan 15, 2022

Now we have an official way to start Wechaty Token Gateway for Puppet XP:

$ npm install -g [email protected] wechaty-puppet-xp
$ wechaty gateway --puppet wechaty-puppet-xp

Related issue:

Abstract

We can create a Wechaty Token Gateway for wechaty-puppet-xp without any problem because all the Puppet in the Wechaty ecosystem will be able to support each other without any problem.

All Wechaty Puppet Providers can be converted to a Wechaty Puppet Service by using our Wechaty Token Gateway, which means the wechaty-puppet-xp can be converted as well.

The Problem

The only problem for using wechaty-puppet-xp with the token gateway is that currently in our docs, the token gateway is started by a docker command, but the wechaty-puppet-xp can not run inside a Linux docker.

The Solution

The solution would be to use Wechaty under your Windows system and start the token gateway manually, which you can learn how to do this from the Wechaty Dockerfile and this line from entrypoint.sh and this line from package.json:

TL;DR: start Wechaty Token Gateway manually with Windows:

npm install -g wechaty
wechaty-io-client

Don't forget to set all environment variables correctly, according to DIY Wechaty Puppet Service

Related issues

@keac
Copy link

keac commented Nov 27, 2021

在运行 wechaty-io-client 时报错

Wechaty Doctor

  1. Wechaty version: 1.10.4
  2. Windows_NT x64 version 6.3.9600 memory 2100/4095 MB
  3. Docker: false
  4. Node version: v16.13.0
  5. Tcp IPC TEST: PASS

image

@huan
Copy link
Member Author

huan commented Nov 27, 2021

@keac You are running into

I'd like to suggest that you can try to run wechaty-io-client.js manually:

$ node node_modules/wechaty/dist/esm/bin/io-client.js

@keac
Copy link

keac commented Nov 27, 2021

感谢,不过我现在遇到了新问题 NOPUPPET 已经在环境变量设置
set WECHATY_PUPPET=wechaty-puppet-xp
image

@huan
Copy link
Member Author

huan commented Nov 27, 2021

Thanks for the reporting, this issue is related to the Mixin dependencies (which will affect the start sequence/order) and should be fixed later.

BTW: it would be great if you can copy/paste the TEXT log message here, instead of the image because the text will be great for searching and reading.

@keac
Copy link

keac commented Nov 27, 2021

node node_modules/wechaty/dist/esm/bin/io-client.js
21:24:14 ERR Brolog level("verbose") not exist, set to silly.
21:24:14 SILL Puppet Config: WECHATY_LOG set level to "verbose"
21:24:14 INFO Config registering process.on("unhandledRejection") for development/debug
21:24:14 VERB Config constructor()
21:24:14 VERB wechaty-puppet-service monkeyPatchMetadataFromHttp2Headers()
21:24:14 VERB PoolifyMixin poolifyMixin(EventEmitter)
21:24:14 VERB WechatifyMixin wechatifyMixin(AbstractPoolifyMixin)
21:24:14 VERB ValidationMixin validationMixin(ContactMixin)
21:24:14 VERB ValidationMixin validationMixin(ContactImplBase)
21:24:14 VERB PoolifyMixin poolifyMixin(ContactImpl)
21:24:14 VERB ValidationMixin validationMixin(ContactSelfMixin)
21:24:14 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:14 VERB ValidationMixin validationMixin(FavoriteMixin)
21:24:14 VERB WechatifyMixin wechatifyMixin(EventEmitter)
21:24:14 VERB ValidationMixin validationMixin(FriendshipMixin)
21:24:14 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:14 VERB ValidationMixin validationMixin(ImageMixin)
21:24:14 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:14 VERB ValidationMixin validationMixin(LocationMixin)
21:24:15 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:15 VERB ValidationMixin validationMixin(UrlLinkMixin)
21:24:15 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:15 VERB ValidationMixin validationMixin(MiniProgramMixin)
21:24:15 VERB WechatifyMixin wechatifyMixin(EventEmitter)
21:24:15 VERB ValidationMixin validationMixin(MessageMixin)
21:24:15 VERB ValidationMixin validationMixin(MessageImplBase)
21:24:15 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:15 VERB ValidationMixin validationMixin(MomentMixin)
21:24:15 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:15 VERB ValidationMixin validationMixin(MoneyMixin)
21:24:15 VERB PoolifyMixin poolifyMixin(EventEmitter)
21:24:15 VERB WechatifyMixin wechatifyMixin(AbstractPoolifyMixin)
21:24:15 VERB ValidationMixin validationMixin(RoomMixin)
21:24:15 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:15 VERB ValidationMixin validationMixin(RoomInvitationMixin)
21:24:15 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:15 VERB PoolifyMixin poolifyMixin(AbstractWechatifyMixin)
21:24:15 VERB ValidationMixin validationMixin(TagMixin)
21:24:15 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:24:15 VERB ValidationMixin validationMixin(DelayMixin)
21:24:15 VERB WechatyGErrorMixin gErrorMixin(WechatySkeleton)
21:24:15 VERB WechatifyUserModuleMixin wechatifyUserModuleMixin(GErrorMixin)
21:24:15 VERB WechatyPluginMixin pluginMixin(WechatifyUserModuleMixin)
21:24:15 VERB WechatyPuppetMixin puppetMixin(PluginMixin)
21:24:15 VERB WechatyLoginMixin loginMixin(PuppetMixin)
21:24:15 VERB WechatyMiscMixin miscMixin(LoginMixin)
21:24:15 VERB WechatyIoMixin ioMixin(MiscMixin)
21:24:15 VERB ValidationMixin validationMixin(WechatyBase)
21:24:15 VERB ValidationMixin validationMixin(WechatyImplBase)

| __        __        _           _
| \ \      / /__  ___| |__   __ _| |_ _   _
|  \ \ /\ / / _ \/ __| '_ \ / _` | __| | | |
|   \ V  V /  __/ (__| | | | (_| | |_| |_| |
|    \_/\_/ \___|\___|_| |_|\__,_|\__|\__, |
|                                     |___/

=============== Powered by Wechaty ===============
       -------- https://www.chatie.io --------

My super power: download cloud bot from www.chatie.io

__________________________________________________


21:24:15 INFO Client Starting for WECHATY_TOKEN: 9c283395-5800-4a0f-bd85-937a07c8caf0
21:24:15 VERB WechatyBuilder singleton()
21:24:15 VERB WechatyBuilder newInstance()
21:24:15 VERB WechatyIoMixin constructor()
21:24:15 VERB WechatyLoginMixin constructor()
21:24:15 VERB WechatyPuppetMixin construct()
21:24:15 VERB WechatifyUserModuleMixin constructor()
21:24:15 VERB WechatySkeleton constructor()
21:24:15 VERB StateSwitch constructor(WechatyReady, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:24:15 VERB ServiceCtl<Wechaty> constructor()
21:24:15 VERB StateSwitch constructor(Wechaty, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:24:15 VERB StateSwitch constructor(WechatyReset, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:24:15 VERB Wechaty constructor()
21:24:15 VERB IoClient constructor({token:9c283395-5800-4a0f-bd85-937a07c8caf0, wechaty:Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>()})
21:24:15 VERB StateSwitch constructor(IoClient, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:24:15 VERB IoClient start()
21:24:15 SILL StateSwitch <IoClient> active() is false
21:24:15 SILL StateSwitch <IoClient> active() is false
21:24:15 VERB StateSwitch <IoClient> active(pending) <- (false)
21:24:15 VERB IoClient hookWechaty()
21:24:15 SILL StateSwitch <IoClient> inactive() is false
21:24:15 VERB WechatySkeleton on(login, listener) registering... listenerCount: 0
21:24:15 VERB WechatySkeleton on(logout, listener) registering... listenerCount: 0
21:24:15 VERB WechatySkeleton on(message, listener) registering... listenerCount: 0
21:24:15 VERB WechatySkeleton on(scan, listener) registering... listenerCount: 0
21:24:15 VERB IoClient startIo() with token 9c283395-5800-4a0f-bd85-937a07c8caf0
21:24:15 SILL StateSwitch <IoClient> inactive() is false
21:24:15 VERB StateSwitch constructor(Io, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:24:15 VERB Io instantiated with apihost[api.chatie.io], token[9c283395-5800-4a0f-bd85-937a07c8caf0], protocol[io|0.0.1], cuid[9a250ebd-acc3-4417-9d51-45f04578420b]
21:24:15 VERB Io start()
21:24:15 SILL StateSwitch <Io> active() is false
21:24:15 VERB StateSwitch <Io> active(pending) <- (false)
21:24:15 VERB Io initEventHook()
21:24:15 VERB WechatySkeleton on(error, listener) registering... listenerCount: 0
21:24:15 VERB WechatySkeleton on(heartbeat, listener) registering... listenerCount: 0
21:24:15 VERB WechatySkeleton on(login, listener) registering... listenerCount: 1
21:24:15 VERB WechatySkeleton on(logout, listener) registering... listenerCount: 1
21:24:15 VERB WechatySkeleton on(message, listener) registering... listenerCount: 1
21:24:15 VERB WechatySkeleton on(scan, listener) registering... listenerCount: 1
21:24:15 VERB Io initWebSocket()
21:24:15 VERB Wechaty init() Raven disabled (import("raven") failed)
21:24:19 VERB Io initWebSocket() connected with protocol [io|0.0.1|9a250ebd-acc3-4417-9d51-45f04578420b||8788]
21:24:19 SILL Io send({"name":"sys","payload":"Wechaty version 1.10.4 with CUID: 9a250ebd-acc3-4417-9d51-45f04578420b"})

21:24:19 VERB WechatySkeleton on(login, listener) registering... listenerCount: 2
21:24:19 VERB WechatySkeleton on(scan, listener) registering... listenerCount: 2
21:24:19 SILL StateSwitch <Io> active() is pending
21:24:19 VERB StateSwitch <Io> active(true) <- (pending)
21:24:19 VERB ServiceCtl<Wechaty> start()
21:24:19 SILL StateSwitch <Wechaty> active() is false
21:24:19 SILL StateSwitch <Wechaty> inactive() is true
21:24:19 SILL StateSwitch <Wechaty> active() is false
21:24:19 VERB StateSwitch <Wechaty> active(pending) <- (false)
21:24:19 VERB ServiceCtl<Wechaty> start() super.start() ...
21:24:19 VERB WechatyIoMixin start()
21:24:19 VERB WechatyLoginMixin start()
21:24:19 VERB WechatyPuppetMixin start()
21:24:19 VERB WechatyPuppetMixin start() super.start() ...
21:24:19 VERB WechatyPluginMixin start()
21:24:19 VERB WechatifyUserModuleMixin start()
21:24:19 VERB WechatySkeleton start()
21:24:19 VERB WechatifyUserModuleMixin _wechatifyUserModules()
21:24:19 VERB WechatifyUserModuleMixin _wechatifyUserModules() initializing Wechaty User Module (WUM) ...
21:24:19 VERB WechatifyMixin wechatifyUserModule(ContactImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(ContactImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(ContactSelfImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(ContactSelfImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(DelayImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(DelayImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(FriendshipImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(FriendshipImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(ImageImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(ImageImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(LocationImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(LocationImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(MessageImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(MessageImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(MiniProgramImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(MiniProgramImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(RoomImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(RoomImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(RoomInvitationImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(RoomInvitationImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(TagImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(TagImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyMixin wechatifyUserModule(UrlLinkImpl)
21:24:19 VERB WechatifyMixin wechatifyUserModule(UrlLinkImpl)(Wechaty#9a250ebd-acc3-4417-9d51-45f04578420b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:24:19 VERB WechatifyUserModuleMixin _wechatifyUserModules() initializing Wechaty User Module (WUM) ... done
21:24:19 VERB WechatyPluginMixin start() installing plugins(global/0, instance/0) ...
21:24:19 VERB WechatyPluginMixin start() installing plugins(global/0, instance/0) ... done
21:24:19 VERB WechatyPuppetMixin start() super.start() ... done
21:24:19 SILL StateSwitch <WechatyReady> active() is false
21:24:19 VERB WechatyPuppetMixin start() initializing puppet instance ...
21:24:19 VERB WechatyPuppetMixin __initPuppetInstance()
21:24:19 VERB WechatyPuppetMixin __initPuppetInstance() instanciating puppet instance ...
21:24:19 VERB PuppetManager resolve({puppet: wechaty-puppet-xp, puppetOptions: undefined})
21:24:19 VERB PuppetManager resolve() resolving name "wechaty-puppet-xp" ...
21:24:19 VERB PuppetManager resolveName(wechaty-puppet-xp)
21:24:19 SILL Io send({"name":"error","payload":{"code":2,"details":"Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'wechaty-puppet-xp' imported from E:\\bot\\node_modules\\wechaty\\dist\\esm\\src\\puppet-management\\puppet-manager.js\n
   at new NodeError (node:internal/errors:371:5)\n    at packageResolve (node:internal/modules/esm/resolve:884:9)\n    at moduleResolve (node:internal/modules/esm/resolve:929:18)\n    at defaultResolve (node:internal/modules/esm/resolve:1044:11)\n    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)\n    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)\n    at ESMLoader.import (node:internal/modules/esm/loader:276:22)\n    at importModuleDynamically (node:internal/modules/esm/translators:111:35)\n    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)\n    at Function.resolveName (file:///E:/bot/node_modules/wechaty/dist/esm/src/puppet-management/puppet-manager.js:81:28)","message":"Cannot find package 'wechaty-puppet-xp' imported from E:\\bot\\node_modules\\wechaty\\dist\\esm\\src\\puppet-management\\puppet-manager.js","name":"Error","stack":"Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'wechaty-puppet-xp' imported from E:\\bot\\node_modules\\wechaty\\dist\\esm\\src\\puppet-management\\puppet-manager.js\n    at new NodeError (node:internal/errors:371:5)\n    at packageResolve (node:internal/modules/esm/resolve:884:9)\n
  at moduleResolve (node:internal/modules/esm/resolve:929:18)\n    at defaultResolve (node:internal/modules/esm/resolve:1044:11)\n    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)\n    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)\n    at ESMLoader.import (node:internal/modules/esm/loader:276:22)\n    at importModuleDynamically (node:internal/modules/esm/translators:111:35)\n    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)\n    at Function.resolveName (file:///E:/bot/node_modules/wechaty/dist/esm/src/puppet-management/puppet-manager.js:81:28)"}})
21:24:19 VERB ServiceCtl<Wechaty> start() super.start() ... done
21:24:19 VERB ServiceCtl<Wechaty> start() this.onStart() ...
21:24:19 VERB Wechaty onStart()
21:24:19 VERB Wechaty <wechaty-puppet-xp>(9c283395-5800-4a0f-bd85-937a07c8caf0) onStart() v1.10.4 is starting...
21:24:19 VERB Wechaty id: 9a250ebd-acc3-4417-9d51-45f04578420b
21:24:20 VERB Wechaty onStart() ... done
21:24:20 VERB ServiceCtl<Wechaty> start() this.onStart() ... done
21:24:20 SILL StateSwitch <Wechaty> active() is pending
21:24:20 VERB StateSwitch <Wechaty> active(true) <- (pending)
21:24:20 VERB ServiceCtl<Wechaty> start() ... done
21:24:20 VERB IoClient startPuppetServer()
21:24:20 ERR IoClient start() exception: NOPUPPET
21:24:20 SILL StateSwitch <IoClient> inactive() is false
21:24:20 VERB StateSwitch <IoClient> inactive(true) <- (false)
21:24:20 ERR Client start() fail: Error: NOPUPPET
21:24:20 VERB IoClient quit()
21:24:20 SILL StateSwitch <IoClient> inactive() is true
21:24:20 SILL StateSwitch <IoClient> inactive() is true
21:24:20 VERB StateSwitch <IoClient> inactive(pending) <- (true)
21:24:20 VERB ServiceCtl<Wechaty> stop()
21:24:20 SILL StateSwitch <Wechaty> inactive() is false
21:24:20 SILL StateSwitch <Wechaty> active() is true
21:24:20 SILL StateSwitch <Wechaty> inactive() is false
21:24:20 VERB StateSwitch <Wechaty> inactive(pending) <- (false)
21:24:20 VERB ServiceCtl<Wechaty> stop() this.onStop() ...
21:24:20 VERB Wechaty onStop()
21:24:20 VERB Wechaty <wechaty-puppet-xp> onStop() v1.10.4 is stopping ...
21:24:20 VERB Wechaty onStop() ... done
21:24:20 VERB ServiceCtl<Wechaty> stop() this.onStop() ... done
21:24:20 VERB ServiceCtl<Wechaty> stop() super.stop() ...
21:24:20 VERB WechatyIoMixin stop()
21:24:20 VERB WechatyLoginMixin stop()
21:24:20 VERB WechatyPuppetMixin stop()
21:24:20 VERB WechatyPuppetMixin stop() stopping puppet ...
21:24:20 SILL Io send({"name":"error","payload":{"code":2,"details":"Error: NOPUPPET\n    at WechatyImpl.get puppet [as puppet] (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:20:23)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:80:43)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/login-mixin.js:92:25)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/io-mixin.js:65:29)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:120:33)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async IoClient.quit (file:///E:/bot/node_modules/wechaty/dist/esm/src/io-client.js:192:13)\n
    at async IoClient.onError (file:///E:/bot/node_modules/wechaty/dist/esm/bin/io-client.js:67:5)","message":"NOPUPPET","name":"Error","stack":"Error: NOPUPPET\n    at WechatyImpl.get puppet [as puppet] (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:20:23)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:80:43)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/login-mixin.js:92:25)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/io-mixin.js:65:29)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:120:33)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async IoClient.quit (file:///E:/bot/node_modules/wechaty/dist/esm/src/io-client.js:192:13)\n    at async IoClient.onError (file:///E:/bot/node_modules/wechaty/dist/esm/bin/io-client.js:67:5)"}})
21:24:20 VERB WechatyPuppetMixin stop() super.stop() ...
21:24:20 VERB WechatyPluginMixin stop() uninstall 0 plugins ...
21:24:20 VERB WechatyPluginMixin stop() uninstall 0 plugins ... done
21:24:20 VERB WechatySkeleton stop()
21:24:20 VERB WechatyPuppetMixin stop() super.stop() ... done
21:24:20 VERB ServiceCtl<Wechaty> stop() super.stop() ... done
21:24:20 SILL StateSwitch <Wechaty> inactive() is pending
21:24:20 VERB StateSwitch <Wechaty> inactive(true) <- (pending)
21:24:20 VERB ServiceCtl<Wechaty> stop() ... done
21:24:20 VERB Io stop()
21:24:20 SILL StateSwitch <Io> inactive() is false
21:24:20 VERB StateSwitch <Io> inactive(pending) <- (false)
21:24:20 SILL Io send()
21:24:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"registered"}
21:24:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"registered"}
21:24:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:24:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:24:23 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:24:23 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:24:23 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:24:23 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:24:23 SILL StateSwitch <Io> active() is false
21:24:23 SILL StateSwitch <Io> inactive() is pending
21:24:23 VERB StateSwitch <Io> inactive(true) <- (pending)
21:24:23 SILL StateSwitch <IoClient> inactive() is pending
21:24:23 VERB StateSwitch <IoClient> inactive(true) <- (pending)

huan added a commit to wechaty/wechaty that referenced this issue Nov 27, 2021
@huan
Copy link
Member Author

huan commented Nov 27, 2021

The NOPUPPET issue should be resolved with [email protected]

Please try this version (after it has been published to NPM around 10 mins after) and let me know the result, thanks!

@keac
Copy link

keac commented Nov 27, 2021

还是存在一样的问题

E:\bot
λ node node_modules/wechaty/dist/esm/bin/io-client.js
21:49:18 ERR Brolog level("verbose") not exist, set to silly.
21:49:18 SILL Puppet Config: WECHATY_LOG set level to "verbose"
21:49:18 INFO Config registering process.on("unhandledRejection") for development/debug
21:49:18 VERB Config constructor()
21:49:18 VERB wechaty-puppet-service monkeyPatchMetadataFromHttp2Headers()
21:49:18 VERB PoolifyMixin poolifyMixin(EventEmitter)
21:49:18 VERB WechatifyMixin wechatifyMixin(AbstractPoolifyMixin)
21:49:18 VERB ValidationMixin validationMixin(ContactMixin)
21:49:18 VERB ValidationMixin validationMixin(ContactImplBase)
21:49:18 VERB PoolifyMixin poolifyMixin(ContactImpl)
21:49:18 VERB ValidationMixin validationMixin(ContactSelfMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(FavoriteMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EventEmitter)
21:49:18 VERB ValidationMixin validationMixin(FriendshipMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(ImageMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(LocationMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(UrlLinkMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(MiniProgramMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EventEmitter)
21:49:18 VERB ValidationMixin validationMixin(MessageMixin)
21:49:18 VERB ValidationMixin validationMixin(MessageImplBase)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(MomentMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(MoneyMixin)
21:49:18 VERB PoolifyMixin poolifyMixin(EventEmitter)
21:49:18 VERB WechatifyMixin wechatifyMixin(AbstractPoolifyMixin)
21:49:18 VERB ValidationMixin validationMixin(RoomMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(RoomInvitationMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB PoolifyMixin poolifyMixin(AbstractWechatifyMixin)
21:49:18 VERB ValidationMixin validationMixin(TagMixin)
21:49:18 VERB WechatifyMixin wechatifyMixin(EmptyBase)
21:49:18 VERB ValidationMixin validationMixin(DelayMixin)
21:49:18 VERB WechatyGErrorMixin gErrorMixin(WechatySkeleton)
21:49:18 VERB WechatifyUserModuleMixin wechatifyUserModuleMixin(GErrorMixin)
21:49:18 VERB WechatyPluginMixin pluginMixin(WechatifyUserModuleMixin)
21:49:18 VERB WechatyIoMixin ioMixin(PluginMixin)
21:49:18 VERB WechatyPuppetMixin puppetMixin(IoMixin)
21:49:18 VERB WechatyLoginMixin loginMixin(PuppetMixin)
21:49:18 VERB WechatyMiscMixin miscMixin(LoginMixin)
21:49:18 VERB ValidationMixin validationMixin(WechatyBase)
21:49:18 VERB ValidationMixin validationMixin(WechatyImplBase)

| __        __        _           _
| \ \      / /__  ___| |__   __ _| |_ _   _
|  \ \ /\ / / _ \/ __| '_ \ / _` | __| | | |
|   \ V  V /  __/ (__| | | | (_| | |_| |_| |
|    \_/\_/ \___|\___|_| |_|\__,_|\__|\__, |
|                                     |___/

=============== Powered by Wechaty ===============
       -------- https://www.chatie.io --------

My super power: download cloud bot from www.chatie.io

__________________________________________________


21:49:18 INFO Client Starting for WECHATY_TOKEN: 9c283395-5800-4a0f-bd85-937a07c8caf0
21:49:18 VERB WechatyBuilder singleton()
21:49:18 VERB WechatyBuilder newInstance()
21:49:18 VERB WechatyLoginMixin constructor()
21:49:18 VERB WechatyPuppetMixin construct()
21:49:18 VERB WechatyIoMixin constructor()
21:49:18 VERB WechatifyUserModuleMixin constructor()
21:49:18 VERB WechatySkeleton constructor()
21:49:18 VERB StateSwitch constructor(WechatyReady, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:49:18 VERB ServiceCtl<Wechaty> constructor()
21:49:18 VERB StateSwitch constructor(Wechaty, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:49:18 VERB StateSwitch constructor(WechatyReset, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:49:18 VERB Wechaty constructor()
21:49:18 VERB IoClient constructor({token:9c283395-5800-4a0f-bd85-937a07c8caf0, wechaty:Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>()})
21:49:18 VERB StateSwitch constructor(IoClient, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:49:18 VERB IoClient start()
21:49:18 SILL StateSwitch <IoClient> active() is false
21:49:18 SILL StateSwitch <IoClient> active() is false
21:49:18 VERB StateSwitch <IoClient> active(pending) <- (false)
21:49:18 VERB IoClient hookWechaty()
21:49:18 SILL StateSwitch <IoClient> inactive() is false
21:49:18 VERB WechatySkeleton on(login, listener) registering... listenerCount: 0
21:49:18 VERB WechatySkeleton on(logout, listener) registering... listenerCount: 0
21:49:18 VERB WechatySkeleton on(message, listener) registering... listenerCount: 0
21:49:18 VERB WechatySkeleton on(scan, listener) registering... listenerCount: 0
21:49:18 VERB IoClient startIo() with token 9c283395-5800-4a0f-bd85-937a07c8caf0
21:49:18 SILL StateSwitch <IoClient> inactive() is false
21:49:18 VERB StateSwitch constructor(Io, "{"log":{"enableTimestamp":true,"logLevel":5,"prefixFilter":{}}}")
21:49:18 VERB Io instantiated with apihost[api.chatie.io], token[9c283395-5800-4a0f-bd85-937a07c8caf0], protocol[io|0.0.1], cuid[b77580d7-e2c5-4e58-b171-6df7d82b4e5b]
21:49:18 VERB Io start()
21:49:18 SILL StateSwitch <Io> active() is false
21:49:18 VERB StateSwitch <Io> active(pending) <- (false)
21:49:18 VERB Io initEventHook()
21:49:18 VERB WechatySkeleton on(error, listener) registering... listenerCount: 0
21:49:18 VERB WechatySkeleton on(heartbeat, listener) registering... listenerCount: 0
21:49:18 VERB WechatySkeleton on(login, listener) registering... listenerCount: 1
21:49:18 VERB WechatySkeleton on(logout, listener) registering... listenerCount: 1
21:49:18 VERB WechatySkeleton on(message, listener) registering... listenerCount: 1
21:49:18 VERB WechatySkeleton on(scan, listener) registering... listenerCount: 1
21:49:18 VERB Io initWebSocket()
21:49:19 VERB Wechaty init() Raven disabled (import("raven") failed)
21:49:20 VERB Io initWebSocket() connected with protocol [io|0.0.1|b77580d7-e2c5-4e58-b171-6df7d82b4e5b||8788]
21:49:20 SILL Io send({"name":"sys","payload":"Wechaty version 1.11.16 with CUID: b77580d7-e2c5-4e58-b171-6df7d82b4e5b"})
21:49:20 VERB WechatySkeleton on(login, listener) registering... listenerCount: 2
21:49:20 VERB WechatySkeleton on(scan, listener) registering... listenerCount: 2
21:49:20 SILL StateSwitch <Io> active() is pending
21:49:20 VERB StateSwitch <Io> active(true) <- (pending)
21:49:20 VERB ServiceCtl<Wechaty> start()
21:49:20 SILL StateSwitch <Wechaty> active() is false
21:49:20 SILL StateSwitch <Wechaty> inactive() is true
21:49:20 SILL StateSwitch <Wechaty> active() is false
21:49:20 VERB StateSwitch <Wechaty> active(pending) <- (false)
21:49:20 VERB ServiceCtl<Wechaty> start() super.start() ...
21:49:20 VERB WechatyLoginMixin start()
21:49:20 VERB WechatyPuppetMixin start()
21:49:20 VERB WechatyPuppetMixin start() super.start() ...
21:49:20 VERB WechatyIoMixin start()
21:49:20 VERB WechatyPluginMixin start()
21:49:20 VERB WechatifyUserModuleMixin start()
21:49:20 VERB WechatySkeleton start()
21:49:20 VERB WechatifyUserModuleMixin _wechatifyUserModules()
21:49:20 VERB WechatifyUserModuleMixin _wechatifyUserModules() initializing Wechaty User Module (WUM) ...
21:49:20 VERB WechatifyMixin wechatifyUserModule(ContactImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(ContactImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(ContactSelfImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(ContactSelfImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(DelayImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(DelayImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(FriendshipImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(FriendshipImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(ImageImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(ImageImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(LocationImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(LocationImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(MessageImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(MessageImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(MiniProgramImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(MiniProgramImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(RoomImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(RoomImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(RoomInvitationImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(RoomInvitationImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(TagImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(TagImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyMixin wechatifyUserModule(UrlLinkImpl)
21:49:20 VERB WechatifyMixin wechatifyUserModule(UrlLinkImpl)(Wechaty#b77580d7-e2c5-4e58-b171-6df7d82b4e5b<>(9c283395-5800-4a0f-bd85-937a07c8caf0))
21:49:20 VERB WechatifyUserModuleMixin _wechatifyUserModules() initializing Wechaty User Module (WUM) ... done
21:49:20 VERB WechatyPluginMixin start() installing plugins(global/0, instance/0) ...
21:49:20 VERB WechatyPluginMixin start() installing plugins(global/0, instance/0) ... done
21:49:20 VERB WechatyPuppetMixin start() super.start() ... done
21:49:20 SILL StateSwitch <WechatyReady> active() is false
21:49:20 VERB WechatyPuppetMixin start() initializing puppet instance ...
21:49:20 VERB WechatyPuppetMixin __initPuppetInstance()
21:49:20 VERB WechatyPuppetMixin __initPuppetInstance() instanciating puppet instance ...
21:49:20 VERB Puppet resolvePuppet({puppet: wechaty-puppet-xp, puppetOptions: undefined})
21:49:20 VERB Puppet resolvePuppet() resolving name "wechaty-puppet-xp" ...
21:49:20 VERB Puppet resolvePuppetName(wechaty-puppet-xp)
21:49:20 ERR Puppet resolvePuppetName
puppet npm module not supported: "wechaty-puppet-xp"
learn more about supported Wechaty Puppet from our official website
<https://wechaty.js.org/docs/puppet-providers>

21:49:20 SILL Io send({"name":"error","payload":{"code":2,"details":"Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'wechaty-puppet-xp' imported from E:\\bot\\node_modules\\wechaty-puppet\\dist\\esm\\src\\puppet\\puppet-resolver.js\n
at new NodeError (node:internal/errors:371:5)\n    at packageResolve (node:internal/modules/esm/resolve:884:9)\n    at moduleResolve (node:internal/modules/esm/resolve:929:18)\n    at defaultResolve (node:internal/modules/esm/resolve:1044:11)\n    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)\n    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)\n    at ESMLoader.import (node:internal/modules/esm/loader:276:22)\n    at importModuleDynamically (node:internal/modules/esm/translators:111:35)\n    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)\n    at resolvePuppetName (file:///E:/bot/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-resolver.js:62:9)","message":"Cannot find package 'wechaty-puppet-xp' imported from E:\\bot\\node_modules\\wechaty-puppet\\dist\\esm\\src\\puppet\\puppet-resolver.js","name":"Error","stack":"Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'wechaty-puppet-xp' imported from E:\\bot\\node_modules\\wechaty-puppet\\dist\\esm\\src\\puppet\\puppet-resolver.js\n    at new NodeError (node:internal/errors:371:5)\n    at packageResolve (node:internal/modules/esm/resolve:884:9)\n    at moduleResolve (node:internal/modules/esm/resolve:929:18)\n    at defaultResolve (node:internal/modules/esm/resolve:1044:11)\n    at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)\n    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:222:40)\n    at ESMLoader.import (node:internal/modules/esm/loader:276:22)\n    at importModuleDynamically (node:internal/modules/esm/translators:111:35)\n    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)\n    at resolvePuppetName (file:///E:/bot/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-resolver.js:62:9)"}}) 21:49:20 VERB ServiceCtl<Wechaty> start() super.start() ... done
21:49:20 VERB ServiceCtl<Wechaty> start() this.onStart() ...
21:49:20 VERB Wechaty onStart()
21:49:20 VERB Wechaty <wechaty-puppet-xp>(9c283395-5800-4a0f-bd85-937a07c8caf0) onStart() v1.11.16 is starting...
21:49:20 VERB Wechaty id: b77580d7-e2c5-4e58-b171-6df7d82b4e5b
21:49:20 VERB Wechaty onStart() ... done
21:49:20 VERB ServiceCtl<Wechaty> start() this.onStart() ... done
21:49:20 SILL StateSwitch <Wechaty> active() is pending
21:49:20 VERB StateSwitch <Wechaty> active(true) <- (pending)
21:49:20 VERB ServiceCtl<Wechaty> start() ... done
21:49:20 VERB IoClient startPuppetServer()
21:49:20 ERR IoClient start() exception: NOPUPPET
21:49:20 SILL StateSwitch <IoClient> inactive() is false
21:49:20 VERB StateSwitch <IoClient> inactive(true) <- (false)
21:49:20 ERR Client start() fail: Error: NOPUPPET
21:49:20 VERB IoClient quit()
21:49:20 SILL StateSwitch <IoClient> inactive() is true
21:49:20 SILL StateSwitch <IoClient> inactive() is true
21:49:20 VERB StateSwitch <IoClient> inactive(pending) <- (true)
21:49:20 VERB ServiceCtl<Wechaty> stop()
21:49:20 SILL StateSwitch <Wechaty> inactive() is false
21:49:20 SILL StateSwitch <Wechaty> active() is true
21:49:20 SILL StateSwitch <Wechaty> inactive() is false
21:49:20 VERB StateSwitch <Wechaty> inactive(pending) <- (false)
21:49:20 VERB ServiceCtl<Wechaty> stop() this.onStop() ...
21:49:20 VERB Wechaty onStop()
21:49:20 VERB Wechaty <wechaty-puppet-xp> onStop() v1.11.16 is stopping ...
21:49:20 VERB Wechaty onStop() ... done
21:49:20 VERB ServiceCtl<Wechaty> stop() this.onStop() ... done
21:49:20 VERB ServiceCtl<Wechaty> stop() super.stop() ...
21:49:20 VERB WechatyLoginMixin stop()
21:49:20 VERB WechatyPuppetMixin stop()
21:49:20 VERB WechatyPuppetMixin stop() stopping puppet ...
21:49:20 SILL Io send({"name":"error","payload":{"code":2,"details":"Error: NOPUPPET\n    at WechatyImpl.get puppet [as puppet] (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:19:23)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:78:43)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/login-mixin.js:91:25)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:120:33)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n    at async IoClient.quit (file:///E:/bot/node_modules/wechaty/dist/esm/src/io-client.js:192:13)\n    at async IoClient.onError (file:///E:/bot/node_modules/wechaty/dist/esm/bin/io-client.js:67:5)","message":"NOPUPPET","name":"Error","stack":"Error: NOPUPPET\n    at WechatyImpl.get puppet [as puppet] (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:19:23)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:78:43)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/login-mixin.js:91:25)\n    at WechatyImpl.stop (file:///E:/bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:120:33)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)\n
   at async IoClient.quit (file:///E:/bot/node_modules/wechaty/dist/esm/src/io-client.js:192:13)\n    at async IoClient.onError (file:///E:/bot/node_modules/wechaty/dist/esm/bin/io-client.js:67:5)"}})
21:49:20 VERB WechatyPuppetMixin stop() super.stop() ...
21:49:20 VERB WechatyIoMixin stop()
21:49:20 VERB WechatyPluginMixin stop() uninstall 0 plugins ...
21:49:20 VERB WechatyPluginMixin stop() uninstall 0 plugins ... done
21:49:20 VERB WechatySkeleton stop()
21:49:20 VERB WechatyPuppetMixin stop() super.stop() ... done
21:49:20 VERB ServiceCtl<Wechaty> stop() super.stop() ... done
21:49:20 SILL StateSwitch <Wechaty> inactive() is pending
21:49:20 VERB StateSwitch <Wechaty> inactive(true) <- (pending)
21:49:20 VERB ServiceCtl<Wechaty> stop() ... done
21:49:20 VERB Io stop()
21:49:20 SILL StateSwitch <Io> inactive() is false
21:49:20 VERB StateSwitch <Io> inactive(pending) <- (false)
21:49:20 SILL Io send()
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"registered"}
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"registered"}
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:49:20 SILL Io initWebSocket() ws.on(message): {"name":"sys","payload":"roger"}
21:49:20 SILL StateSwitch <Io> active() is false
21:49:20 SILL StateSwitch <Io> inactive() is pending
21:49:20 VERB StateSwitch <Io> inactive(true) <- (pending)
21:49:20 SILL StateSwitch <IoClient> inactive() is pending
21:49:20 VERB StateSwitch <IoClient> inactive(true) <- (pending)

@keac
Copy link

keac commented Nov 27, 2021

在执行 node node_modules\wechaty\dist\esm\bin\puppet-install.js 时出现以下报错

 node node_modules\wechaty\dist\esm\bin\puppet-install.js
22:14:50 ERR Brolog level("verbose") not exist, set to silly.
22:14:50 SILL Puppet Config: WECHATY_LOG set level to "verbose"
22:14:50 INFO PuppetInstall main() installing ...
22:14:50 INFO PuppetInstall installing ... Shell: "npm install install --no-save wechaty-puppet-service@>=1.11.2 wechaty
-puppet-mock@>=1.10.2 wechaty-puppet-wechat@>=1.10.1 wechaty-puppet-wechat4u@>=1.10.2 wechaty-puppet-padlocal@>=0.4.1 we
chaty-puppet-xp@>=1.10.2 wechaty-puppet-oicq@>=1.10.2 wechaty-puppet-official-account@>=1.10.2 wechaty-puppet-gitter@>=1
.10.1 wechaty-puppet-lark@>=0.4.5 wechaty-puppet-whatsapp@>=1.10.4 wechaty-puppet-walnut@>=0.1.41"

node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
    at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn npm',
  path: 'npm',
  spawnargs: [
    'install',
    '--no-save',
    'wechaty-puppet-service@>=1.11.2',
    'wechaty-puppet-mock@>=1.10.2',
    'wechaty-puppet-wechat@>=1.10.1',
    'wechaty-puppet-wechat4u@>=1.10.2',
    'wechaty-puppet-padlocal@>=0.4.1',
    'wechaty-puppet-xp@>=1.10.2',
    'wechaty-puppet-oicq@>=1.10.2',
    'wechaty-puppet-official-account@>=1.10.2',
    'wechaty-puppet-gitter@>=1.10.1',
    'wechaty-puppet-lark@>=0.4.5',
    'wechaty-puppet-whatsapp@>=1.10.4',
    'wechaty-puppet-walnut@>=0.1.41'
  ]
}

@huan
Copy link
Member Author

huan commented Nov 27, 2021

According to the below error message:

Cannot find package 'wechaty-puppet-xp' imported from E:\bot\node_modules\wechaty-puppet\dist\esm\src\puppet\puppet-resolver.js\n

It seems that you have no wechaty-puppet-xp installed in your project.

Can you run npm install wechaty-puppet-xp and then try again to see if it can fix your problem?

huan added a commit to wechaty/wechaty that referenced this issue Nov 27, 2021
@huan
Copy link
Member Author

huan commented Nov 27, 2021

We have switched to using the cross-spawn module instead of the Node.js native child_process.

Please try the latest [email protected] to see if the puppet-install.js can work as expected.

@keac
Copy link

keac commented Nov 28, 2021

npm install wechaty-puppet-xp 并不能解决问题

puppet-install.js 可以安装但是出现了新的问题

λ node node_modules\wechaty\dist\esm\bin\puppet-install.js
10:52:46 INFO PuppetInstall main() installing ...
10:52:46 INFO PuppetInstall installing ... Shell: "npm install install --no-save wechaty-puppet-service@>=1.11.2 wechaty-puppet-mock@>=1.10.2 wechaty-puppet-wechat@>=1.10.3 wechaty-puppet-wechat4u@>=1.10.2 wechaty-puppet-padlocal@>=0.4.1 wechaty-puppet-xp@>=1.10.2 wechaty-puppet-oicq@>=1.10.2 wechaty-puppet-official-account@>=1.10.2 wechaty-puppet-gitter@>=1.10.1 wechaty-puppet-lark@>=0.4.5 wechaty-puppet-whatsapp@>=1.10.4 wechaty-puppet-walnut@>=0.1.41"

npm ERR! code ETARGET
npm ERR! notarget No matching version found for wechaty-puppet-oicq@>=1.10.2.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Local\npm-cache\_logs\2021-11-28T02_52_55_215Z-debug.log
10:52:55 INFO PuppetInstall main() installing ... done

@huan
Copy link
Member Author

huan commented Nov 28, 2021

npm ERR! notarget No matching version found for wechaty-puppet-oicq@>=1.10.2.

It seems that you are using an outdated NPM mirror/CDN/cache.

Please disable any mirror/CDN/cache for your NPM and try again.

npm install wechaty-puppet-xp 并不能解决问题

What's the new log message?

@keac
Copy link

keac commented Nov 28, 2021

另外我再次运行 node node_modules/wechaty/dist/esm/bin/io-client.js时候发现这段报错,不知道是不是wechaty-puppet-xp的问题

11:09:50 SILL Io send({"name":"error","payload":{"code":2,"details":"file:///E:/bot/node_modules/wechaty-puppet-xp/dist/esm/src/config.js:1\nimport { FileBox, } from 'wechaty-puppet';\n         ^^^^^^^\nSyntaxError: The requested module 'wechaty-puppet' does not provide an export named 'FileBox'\n    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)\n    at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)\n    at async Promise.all (index 0)\n    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n    at async resolvePuppetName (file:///E:/bot/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-resolver.js:62:24)\n    at async Module.resolvePuppet (file:///E:/bot/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-resolver.js:34:22)\n    at async WechatyImpl.__initPuppetInstance (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:106:36)\n    at async WechatyImpl.start (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:43:17)\n    at async WechatyImpl.start (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/login-mixin.js:84:13)\n    at async WechatyImpl.start (file:///E:/bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:55:21)","message":"The requested module 'wechaty-puppet' does not provide an export named 'FileBox'","name":"SyntaxError","stack":"file:///E:/bot/node_modules/wechaty-puppet-xp/dist/esm/src/config.js:1\nimport { FileBox, } from 'wechaty-puppet';\n         ^^^^^^^\nSyntaxError: The requested module 'wechaty-puppet' does not provide an export named 'FileBox'\n    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)\n    at async ModuleJob.run (node:internal/modules/esm/module_job:181:5)\n    at async Promise.all (index 0)\n    at async ESMLoader.import (node:internal/modules/esm/loader:281:24)\n    at async resolvePuppetName (file:///E:/bot/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-resolver.js:62:24)\n    at async Module.resolvePuppet (file:///E:/bot/node_modules/wechaty-puppet/dist/esm/src/puppet/puppet-resolver.js:34:22)\n
  at async WechatyImpl.__initPuppetInstance (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:106:36)\n    at async WechatyImpl.start (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/puppet-mixin.js:43:17)\n    at async WechatyImpl.start (file:///E:/bot/node_modules/wechaty/dist/esm/src/wechaty-mixins/login-mixin.js:84:13)\n    at async WechatyImpl.start (file:///E:/bot/node_modules/state-switch/dist/esm/src/service-ctl/service-ctl.js:55:21)"}})

@keac
Copy link

keac commented Nov 28, 2021

我认为是国内源没有同步的问题
80c2f388589de4019f0d113884f8d7e

使用npmmirror sync 同步了一下再安装解决可以正常运行了 感谢
https://npmmirror.com/sync/wechaty-puppet-xp?spm=a2c6h.24755359.0.0.6c8321dbr1UQNB

@huan
Copy link
Member Author

huan commented Nov 28, 2021

It's great to know that your npm mirror has been synced.

From the FileBox import error message, I believe the problem is because you have an outdated version of Wechaty Puppet XP installed.

Please update your wechaty-puppet-xp to the latest version 1.10.2 and try again.

@huan
Copy link
Member Author

huan commented Jan 14, 2022

Now we have an official way to start Wechaty Token Gateway for Puppet XP:

$ npm install -g [email protected] wechaty-puppet-xp
$ wechaty gateway --puppet wechaty-puppet-xp

Related issue:

@keac
Copy link

keac commented Jan 28, 2022

环境变量设置无法生效

PS C:\Users\Administrator> wechaty-P wechaty-puppet-xp
PS C:\Users\Administrator> set WECHATY_PUPPET=wechaty-puppet-service
PS C:\Users\Administrator> set WECHATY_PUPPET_SERVICE_TOKEN=e8fecfe5-7be4-4e51-86b4-07ffb175c603
PS C:\Users\Administrator>
PS C:\Users\Administrator> set WECHATY_PUPPET=wechaty-puppet-xp
PS C:\Users\Administrator> set WECHATY_TOKEN=e8fecfe5-7be4-4e51-86b4-07ffb175c603
PS C:\Users\Administrator> set WECHATY_PUPPET="wechaty-puppet-xp"
PS C:\Users\Administrator> set WECHATY_TOKEN="e8fecfe5-7be4-4e51-86b4-07ffb175c603"
PS C:\Users\Administrator> set WECHATY_PUPPET_SERVER_PORT=61932
PS C:\Users\Administrator> set WECHATY_LOG="verbose"
}
13:21:05 INFO Gateway Registering Wechaty Puppet Token Gateway Service Discovery ... success


    Your have successfully ran Wechaty Token Gateway with the below settings:
      1. token: insecure_4296d1c9-86a2-416e-a3f3-f466a9068f83
      2. port: 8788
      3. puppet: wechaty-puppet-xp
      4. puppetToken:

    The Wechaty Puppet Token Gateway Service Address is 127.0.0.1:8788, please make sure it can be public accessed via t
he internet.

    You can save the below command to restore the token gateway in future:

    $ wechaty gateway --token insecure_4296d1c9-86a2-416e-a3f3-f466a9068f83 --port 8788 --puppet wechaty-puppet-xp --pup
pet-token

    You can set the below environment variables for your Wechaty program to use the DIY token provided by this gateway:
    __________________________________________________________________________
    $ export WECHATY_PUPPET=wechaty-puppet-service
    $ export WECHATY_PUPPET_SERVICE_TOKEN=insecure_4296d1c9-86a2-416e-a3f3-f466a9068f83
    $ npm start

    Please file an issue if you found any bug or have feature request at https://github.com/wechaty/wechaty/issues
    Join the Wechaty Community Gitter Channel at https://gitter.im/wechaty/wechaty if you have any questions.

@huan
Copy link
Member Author

huan commented Jan 28, 2022

I have not test under windows, but it should work.

If you can figure the problem out, I'd like to accept a PR to fix it.

@suguer
Copy link

suguer commented Mar 3, 2022

你好,我把这里的评论看过一次,但还是不太清楚怎么搭建一个wechaty-puppet-xp,然后用python连接,我现在的wechaty-puppet-xp是能运行成功的,

@huan
Copy link
Member Author

huan commented Mar 3, 2022

TL;DR:

All you need to run is:

$ npm install -g [email protected] wechaty-puppet-xp
$ wechaty gateway --puppet wechaty-puppet-xp

Then by reading the output messages, you can find the published new token for your Python Wechaty program.

@suguer
Copy link

suguer commented Mar 3, 2022

TL;DR:

All you need to run is:

$ npm install -g [email protected] wechaty-puppet-xp
$ wechaty gateway --puppet wechaty-puppet-xp
Your have successfully ran Wechaty Token Gateway with the below settings:
  1. token: insecure_1c462af8-198f-4f0d-93ea-fb567fc81721
  2. port: 8788
  3. puppet: wechaty-puppet-xp
  4. puppetToken:

The Wechaty Puppet Token Gateway Service Address is 127.0.0.1:8788, please make sure it can be public accessed via the internet.

You can save the below command to restore the token gateway in future:

$ wechaty gateway --token insecure_1c462af8-198f-4f0d-93ea-fb567fc81721 --port 8788 --puppet wechaty-puppet-xp --puppet-token

You can set the below environment variables for your Wechaty program to use the DIY token provided by this gateway:
__________________________________________________________________________
$ export WECHATY_PUPPET=wechaty-puppet-service
$ export WECHATY_PUPPET_SERVICE_TOKEN=insecure_1c462af8-198f-4f0d-93ea-fb567fc81721
$ npm start

Please file an issue if you found any bug or have feature request at https://github.com/wechaty/wechaty/issues
Join the Wechaty Community Gitter Channel at https://gitter.im/wechaty/wechaty if you have any questions..

is it means successly? and then now i need to have a available public ip ?

@huan
Copy link
Member Author

huan commented Mar 3, 2022

Yes, it seems the gateway setup is successfully in your server.

You need to have a public IP with firewall permissions if you want to use this token other than the local machine.

@suguer
Copy link

suguer commented Mar 3, 2022

ok, thank you very much,
I have another question, can i use gateway and python in the same server with Intranet IP

@huan
Copy link
Member Author

huan commented Mar 3, 2022

Yes you can.

As you see the IP is 127.0.0.1 in the log message, that's because the Wechaty gateway detected that you have no any public IP, so it can not get an external IP.

There will be two cases you need to deal with:

  1. The same server: you can just use the token, because the token will be resolved as 127.0.0.1
  2. Different Intranet server: you need to specify the environment variables WECHATY_PUPPET_SERVICE_ENDPOINT to your server internal IP:PORT.

Please let me know if it works for you

@suguer
Copy link

suguer commented Mar 3, 2022

it is failed
when i run python show this

2022-03-03 14:51:56,037 - Wechaty - INFO - on() listen event <scan> with <<function on_scan at 0x000002B163195430>>
2022-03-03 14:51:56,037 - Wechaty - INFO - on() listen event <login> with <<function on_login at 0x000002B166203040>>
2022-03-03 14:51:56,037 - Wechaty - INFO - on() listen event <message> with <<function on_message at 0x000002B162EFDD30>>
2022-03-03 14:51:56,073 - PuppetService - WARNING - there are endpoint<127.0.0.1:8788> and token<insecure_156f31cd-8629-4a4d-a6ee-9bab5ccf3aea>, and the endpoint will be used for service ...
2022-03-03 14:51:56,073 - Wechaty - INFO - init_puppet_event_bridge() <<wechaty_puppet_service.puppet.PuppetService object at 0x000002B1663064C0>>
2022-03-03 14:51:56,073 - Wechaty - INFO - initPuppetEventBridge() puppet.on(dong) (listenerCount:1) registering...
2022-03-03 14:51:56,073 - Wechaty - INFO - initPuppetEventBridge() puppet.on(error) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(heart-beat) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(ready) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - receive <reset> event <%s>
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(reset) (listenerCount:0) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(friendship) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(login) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(logout) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(message) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-invite) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-join) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-leave) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(room-topic) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - initPuppetEventBridge() puppet.on(scan) (listenerCount:1) registering...
2022-03-03 14:51:56,074 - Wechaty - INFO - starting puppet ...
2022-03-03 14:51:56,074 - PuppetService - INFO - init puppet ...
2022-03-03 14:51:56,092 - PuppetService - INFO - starting the puppet ...
2022-03-03 14:51:56,104 - Wechaty - ERROR - The network is not good, the bot will try to restart after 60 seconds.
But here are some suggestions for you:
* 查看token是否可用?(过期或协议不可用)
* docker 服务是否正常启动?
* python-wechaty bot 是否正常启动?
* python-wechaty bot 是否能ping通docker服务?
* 由于版本细节问题,目前python-wechaty 支持最好的wechaty镜像为:[wechaty/wechaty:0.65](https://hub.docker.com/layers/wechaty/wechaty/0.65/images/sha256-d39b9fb5dece3a8ffa88b80a8ccfd916be14b9d0de72115732c3ee714b0d6a96?context=explore)

I suggest that you should follow the template code from: https://wechaty.readthedocs.io/zh_CN/latest/ to avoid the unnecessary bugs.

@huan
Copy link
Member Author

huan commented Mar 3, 2022

Sad to know that.

My suggestion is to try TypeScript of Wechaty and see if it works with TypeScript (you can refer to the getting started official docs at https://wechaty.js.org/docs/getting-started/).

If the TS works then it means that the token gateway is in service, then you should file an issue in the Python Wechaty getting started repo.

@suguer
Copy link

suguer commented Mar 3, 2022

ok, Thank you for helping me with my big problem

@huan
Copy link
Member Author

huan commented Mar 3, 2022

You are welcome, and I hope you can solve the big problem soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants