wechaty/wechaty-puppet-padchat

出现code dump报错

Closed this issue · 5 comments

操作系统: Ubuntu 18.04

出错日志:

02:11:04 WARN PadchatRpc initWebSocket() ws.on(close) code: 1005, reason:
(node:6352) UnhandledPromiseRejectionWarning: Error: WebSocket is not open: readyState 3 (CLOSED)
    at WebSocket.ping (/root/wechaty-getting-started/node_modules/ws/lib/websocket.js:249:19)
    at WXHeartBeat.then.catch.finally (/root/wechaty-getting-started/node_modules/wechaty/node_modules/wechaty-puppet-padchat/dist/src/padchat-rpc.js:299:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6352) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not
handled with .catch(). (rejection id: 1)
(node:6352) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Contact<开源社-bot> logout
Segmentation fault (core dumped)
npm ERR! code ELIFECYCLE
npm ERR! errno 139
npm ERR! wechaty-getting-started@0.1.0 start: `node examples/starter-bot.js`
npm ERR! Exit status 139
npm ERR!
npm ERR! Failed at the wechaty-getting-started@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2018-11-14T18_14_43_608Z-debug.log

# cat /root/.npm/_logs/2018-11-14T18_14_43_608Z-debug.log


0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.4.1
3 info using node@v10.13.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle wechaty-getting-started@0.1.0~prestart: wechaty-getting-started@0.1.0
6 info lifecycle wechaty-getting-started@0.1.0~start: wechaty-getting-started@0.1.0
7 verbose lifecycle wechaty-getting-started@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle wechaty-getting-started@0.1.0~start: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/root/wechaty-getting-started/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle wechaty-getting-started@0.1.0~start: CWD: /root/wechaty-getting-started
10 silly lifecycle wechaty-getting-started@0.1.0~start: Args: [ '-c', 'node examples/starter-bot.js' ]
11 silly lifecycle wechaty-getting-started@0.1.0~start: Returned: code: 139  signal: null
12 info lifecycle wechaty-getting-started@0.1.0~start: Failed to exec start script
13 verbose stack Error: wechaty-getting-started@0.1.0 start: `node examples/starter-bot.js`
13 verbose stack Exit status 139
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:962:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid wechaty-getting-started@0.1.0
15 verbose cwd /root/wechaty-getting-started
16 verbose Linux 4.15.0-38-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v10.13.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 139
22 error wechaty-getting-started@0.1.0 start: `node examples/starter-bot.js`
22 error Exit status 139
23 error Failed at the wechaty-getting-started@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 139, true ]

版本号:

wechaty-getting-started@0.1.0
├─┬ wechaty@0.22.4
│ ├─┬ wechaty-puppet@0.14.1
│ ├─┬ wechaty-puppet-padchat@0.16.2
│ ├─┬ wechaty-puppet-puppeteer@0.14.2
├─┬ wechaty-puppet-padchat@0.17.21

Seems like this is not using the latest wechaty-puppet-padchat version, wechaty install the stable version of wechaty-puppet-padchat instead of the @next version. We need to publish a new stable version to have some fix in place.

Here is a work around, you could try to do something like below:

import { Wechaty } from 'wechaty'
import { PuppetPadchat } from 'wechaty-puppet-padchat'

const puppet = new PuppetPadchat({
  token: '{Your Token}',
})

const bot = new Wechaty({
  name: '{Your bot name}',
  puppet: puppet,
})

In this way, you will use the wechaty-puppet-padchat which from the root of node_modules.

我的js代码如下:

const { Wechaty } = require('wechaty');
const { PuppetPadchat } = require('wechaty-puppet-padchat');

const bot = new Wechaty(
{
name: "kaiyuanshe",
puppet: 'wechaty-puppet-padchat',
puppetOptions: {
token: "token_str"
}
}
);

....

能够正常启动,但是又一次出现了core dump!

首先这段代码引用了PuppetPadchat, 但是在初始化Wechaty的时候,并没有用到这个PuppetPadchat,所以还是会使用0.16的版本

麻烦再用我给的代码试一下

Hi @zhuangbiaowei

Is your problem resolved?

Close this issue for long time no response