wechaty/wechaty

error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

atubo2012 opened this issue · 4 comments

Provide Your Network Information

  1. Where is the location of your server? (i.e. City, or In/Out China)
    Shanghai China
  2. Which cloud platform(AliYun/Qcloud/DigitalOcean/etc) are you using?
    Qcloud

Run npm run doctor or wechaty run doctor(for docker user), paste output here

0 info it worked if it ends with ok
1 verbose cli [ '/root/download/node-v6.11.0-linux-x64/bin/node',
1 verbose cli   '/root/download/node-v6.11.0-linux-x64/bin/npm',
1 verbose cli   'run',
1 verbose cli   'doctor' ]
2 info using npm@3.10.10
3 info using node@v6.11.0
4 verbose run-script [ 'predoctor', 'doctor', 'postdoctor' ]
5 info lifecycle wechaty@0.13.93~predoctor: wechaty@0.13.93
6 silly lifecycle wechaty@0.13.93~predoctor: no script for predoctor, continuing
7 info lifecycle wechaty@0.13.93~doctor: wechaty@0.13.93
8 verbose lifecycle wechaty@0.13.93~doctor: unsafe-perm in lifecycle true
9 verbose lifecycle wechaty@0.13.93~doctor: PATH: /root/download/node-v6.11.0-linux-x64/lib/node_modules/npm/bin/node-gyp-bin:/root/workspace/nodejs/node_module
s/wechaty/node_modules/.bin:/root/workspace/nodejs/node_modules/.bin:/root/download/node-v6.11.0-linux-x64/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
:/root/bin
10 verbose lifecycle wechaty@0.13.93~doctor: CWD: /root/workspace/nodejs/node_modules/wechaty
11 silly lifecycle wechaty@0.13.93~doctor: Args: [ '-c', 'npm run check-node-version && ts-node bin/doctor' ]
12 silly lifecycle wechaty@0.13.93~doctor: Returned: code: 1  signal: null
13 info lifecycle wechaty@0.13.93~doctor: Failed to exec doctor script
14 verbose stack Error: wechaty@0.13.93 doctor: `npm run check-node-version && ts-node bin/doctor`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (/root/download/node-v6.11.0-linux-x64/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (/root/download/node-v6.11.0-linux-x64/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:891:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid wechaty@0.13.93
16 verbose cwd /root/workspace/nodejs/node_modules/wechaty
17 error Linux 3.10.0-327.el7.x86_64
18 error argv "/root/download/node-v6.11.0-linux-x64/bin/node" "/root/download/node-v6.11.0-linux-x64/bin/npm" "run" "doctor"
19 error node v6.11.0
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error wechaty@0.13.93 doctor: `npm run check-node-version && ts-node bin/doctor`
22 error Exit status 1
23 error Failed at the wechaty@0.13.93 doctor script 'npm run check-node-version && ts-node bin/doctor'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the wechaty package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     npm run check-node-version && ts-node bin/doctor
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs wechaty
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls wechaty
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Expected behavior

Program run normally .

Actual behavior

Program exit with some exception.

Steps to reproduce the behavior (and fixes, if any)

There are two nodejs with diffrent version in OS.
One is v6.11.0 which is installed when I get the OS.
In order to run wechaty , I download node v8.11.1 and start my program(wc.js) like this:
/root/download/node-v8.11.1-x64/bin/node wc.js

Full Output Logs

$ WECHATY_LOG=silly npm run ts-node mybot.ts

# or 

$ WECHATY_LOG=silly node dist/mybot.js
Show Logs ### Paste the full output logs here with `WECHATY_LOG=silly` set
# PASTE FULL LOG OUTPUT AT HERE:

17:17:00 INFO Wechaty v0.13.93 starting...
17:17:00 ERR PuppetWebBridge init() exception: Error: Failed to launch chrome!
/root/workspace/nodejs/node_modules/puppeteer/.local-chromium/linux-549031/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

17:17:00 ERR PuppetWeb initBridge() exception: Failed to launch chrome!
/root/workspace/nodejs/node_modules/puppeteer/.local-chromium/linux-549031/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

17:17:00 WARN PuppetWebBridge quit() page.close() exception: TypeError: Cannot read property 'close' of undefined
17:17:00 WARN PuppetWebBridge quit() browser.close() exception: TypeError: Cannot read property 'close' of undefined
17:17:00 ERR PuppetWeb init() exception: Error: Failed to launch chrome!
/root/workspace/nodejs/node_modules/puppeteer/.local-chromium/linux-549031/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

17:17:00 ERR Wechaty start() exception: Failed to launch chrome!
/root/workspace/nodejs/node_modules/puppeteer/.local-chromium/linux-549031/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

(node:28669) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
/root/workspace/nodejs/node_modules/puppeteer/.local-chromium/linux-549031/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory


TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md

    at onClose (/root/workspace/nodejs/node_modules/puppeteer/lib/Launcher.js:255:14)
    at Interface.helper.addEventListener (/root/workspace/nodejs/node_modules/puppeteer/lib/Launcher.js:244:50)
    at emitNone (events.js:111:20)
    at Interface.emit (events.js:208:7)
    at Interface.close (readline.js:370:8)
    at Socket.onend (readline.js:149:10)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickDomainCallback (internal/process/next_tick.js:218:9)
(node:28669) 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:28669) [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.
huan commented

You need to be able to run chrome in your linux environment.

chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

This message tells you that you are missing some librarys which is required to run chrome browser.

huan commented

https://github.com/Chatie/wechaty/blob/cca528894af37483960eed8dd1d5a0803f4b106f/Dockerfile#L41-L51

You can try this script to help you to install all the required librarys if you are using Ubuntu linux.

huan commented

Update Sep 2021

  • error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory
    • apt install libnss3
  • error while loading shared libraries: libgbm.so.1: cannot open shared object file: No such file or directory
    • apt install libgbm-dev
  • error while loading shared libraries: libxshmfence.so.1: cannot open shared object file: No such file or directory
    • apt install libxshmfence-dev