getting-started: run example http://pad-local.com/#/learn failed.

When I run example http://pad-local.com/#/learn step-by-step, got error at last step “npm run demo”

Env:

wechaty-puppet-padlocal-demo: 0.1.2
wechaty: 0.60.12
wechaty-puppet-padlocal: 0.4.2
node: v17.8.0
npm: 8.5.5
OS: macOS BigSur 11.6 intel

Error:

➜  wechaty-puppet-padlocal-demo git:(master) ✗ sudo npm run demo

> wechaty-puppet-padlocal-demo@0.1.2 demo
> ./node_modules/.bin/ts-node main.ts


/Users/xxx/tmp/wechaty2/wechaty-puppet-padlocal-demo/node_modules/ts-node/src/index.ts:513
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
main.ts:13:5 - error TS2322: Type 'PuppetPadlocal' is not assignable to type '"wechaty-puppet-hostie" | "wechaty-puppet-puppeteer" | "wechaty-puppet-service" | "wechaty-puppet-mock" | "wechaty-puppet-wechat" | "wechaty-puppet-wechat4u" | "wechaty-puppet-padlocal" | ... 6 more ... | Puppet'.
Type 'PuppetPadlocal' is missing the following properties from type 'Puppet': cacheContactPayload, cacheFriendshipPayload, cacheMessagePayload, cacheRoomPayload, and 17 more.

13     puppet,
~~~~~~

node_modules/wechaty/dist/src/wechaty.d.ts:13:5
13     puppet?: PuppetModuleName | Puppet;
~~~~~~
The expected type comes from property 'puppet' which is declared here on type 'WechatyOptions'

    at createTSError (/Users/xxx/tmp/wechaty2/wechaty-puppet-padlocal-demo/node_modules/ts-node/src/index.ts:513:12)
    at reportTSError (/Users/xxx/tmp/wechaty2/wechaty-puppet-padlocal-demo/node_modules/ts-node/src/index.ts:517:19)
    at getOutput (/Users/xxx/tmp/wechaty2/wechaty-puppet-padlocal-demo/node_modules/ts-node/src/index.ts:752:36)
    at Object.compile (/Users/xxx/tmp/wechaty2/wechaty-puppet-padlocal-demo/node_modules/ts-node/src/index.ts:968:32)
    at Module.m._compile (/Users/xxx/tmp/wechaty2/wechaty-puppet-padlocal-demo/node_modules/ts-node/src/index.ts:1056:42)
    at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/xxx/tmp/wechaty2/wechaty-puppet-padlocal-demo/node_modules/ts-node/src/index.ts:1059:12)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Great to know that your confusion had been resolved!

Looking forward to seeing your future process, and have a nice day!

You are welcome.

There might be confusing to users that when we are saying “TOKEN”, there are two types of them:

  1. Wechaty Puppet Provider (WPP) TOKEN
  2. Wechaty Puppet Service (WPS) TOKEN

The WPP TOKEN and the WPS TOKEN are totally different, and if you use one for another, it will not work.

Wechaty Puppet Provider (WPP)

  1. PadLocal (wechaty-puppet-padlocal) token is only for PadLocal
  2. SimplePad (wechaty-puppet-simplepad) token is only for SimplePad

And here’s the most important one: Wechaty Puppet Service (WPS, wechaty-puppet-service) token

Wechaty Puppet Service (WPS)

The WPS TOKEN is the most compatible token for Polyglot (Python, Go, .NET, etc) Wechaty:

  1. You can use a Wechaty Gateway to convert the WPP (PadLocal / SimplePad / XP) token to a WPS token (refer to https://github.com/wechaty/puppet-xp/issues/38):
    npm install -g wechaty@1.11
    wechaty gateway
    
  2. Or you can use native WPS like Paimon, WXWork, which means their TOKEN is a WPS TOKEN and gateway is not required.

I hope the above information can help you to have a better understanding of the WPS TOKEN v.s. the WPP TOKEN, please feel free to file an new issue if you have more questions.