Medium / phantomjs

NPM wrapper for installing phantomjs
Other
1.42k stars 435 forks source link

Failed to use version 2.1.7 on linux 1.9.x works well #662

Open eugeneglova opened 7 years ago

eugeneglova commented 7 years ago

I have an issue with running phantomjs on linux

[eglova@leelee.ric webroot]$ npm i phantomjs
npm WARN package.json myfonts@0.0.1 No repository field.
npm WARN package.json myfonts@0.0.1 No license field.
npm WARN deprecated phantomjs@2.1.7: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
npm WARN deprecated tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
-
> phantomjs@2.1.7 install /home/eglova/dev/www/webroot/node_modules/phantomjs
> node install.js

PhantomJS not found on PATH
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1482941790503/phantomjs-2.1.1-linux-x86_64 -> /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs
phantomjs@2.1.7 node_modules/phantomjs
├── progress@1.1.8
├── kew@0.7.0
├── which@1.2.12 (isexe@1.1.2)
├── request-progress@2.0.1 (throttleit@1.0.0)
├── hasha@2.2.0 (is-stream@1.1.0, pinkie-promise@2.0.1)
├── extract-zip@1.5.0 (debug@0.7.4, mkdirp@0.5.0, yauzl@2.4.1, concat-stream@1.5.0)
├── fs-extra@0.26.7 (path-is-absolute@1.0.1, klaw@1.3.1, jsonfile@2.4.0, graceful-fs@4.1.11, rimraf@2.5.4)
└── request@2.67.0 (is-typedarray@1.0.0, oauth-sign@0.8.2, aws-sign2@0.6.0, forever-agent@0.6.1, tunnel-agent@0.4.3, caseless@0.11.0, stringstream@0.0.5, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, node-uuid@1.4.7, combined-stream@1.0.5, qs@5.2.1, tough-cookie@2.2.2, mime-types@2.1.13, bl@1.0.3, har-validator@2.0.6, hawk@3.1.3, http-signature@1.1.1, form-data@1.0.1)
[eglova@leelee.ric webroot]$ /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libz.so.1: no version information available (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.9' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.10' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
[eglova@leelee.ric webroot]$
uname -a
Linux leelee.ric.mf 2.6.18-409.el5 #1 SMP Tue Mar 15 18:13:50 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux
orangecms commented 7 years ago

You are missing libraries that are linked dynamically, as it says in the error message. You can check which ones you need via ldd /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs. ldd lists shared object dependencies.

eugeneglova commented 7 years ago
[eglova@leelee.ric webroot]$ ldd /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libz.so.1: no version information available (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.9' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.10' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
/home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by /home/eglova/dev/www/webroot/node_modules/phantomjs/lib/phantom/bin/phantomjs)
    linux-vdso.so.1 =>  (0x00007fff4ddc8000)
    libz.so.1 => /lib64/libz.so.1 (0x00000035af600000)
    libfontconfig.so.1 => /usr/lib64/libfontconfig.so.1 (0x00000035b6e00000)
    libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00000035b5e00000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00000035aee00000)
    librt.so.1 => /lib64/librt.so.1 (0x00000035afe00000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00000035af200000)
    libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x00000035b4e00000)
    libm.so.6 => /lib64/libm.so.6 (0x00000035afa00000)
    libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00000035b0a00000)
    libc.so.6 => /lib64/libc.so.6 (0x00000035aea00000)
    /lib64/ld-linux-x86-64.so.2 (0x00000035ae600000)
    libexpat.so.0 => /lib64/libexpat.so.0 (0x00000035b6200000)

but why older version works well?

orangecms commented 7 years ago

The older version was not linked against the new versions of the libraries. I just installed PhantomJS 1.9.x through npm:

🐢  ./node_modules/phantomjs/lib/phantom/bin/phantomjs --version
1.9.7
🐢  strings node_modules/phantomjs/lib/phantom/bin/phantomjs | grep LIBC | sort
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.4
GLIBCXX_3.4

For 2.0.0:

🐢  phantomjs --version
2.0.0
🐢  strings $(which phantomjs) | grep LIBC | sort
GLIBC_2.10
GLIBC_2.11
GLIBC_2.14
GLIBC_2.15
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.3.2
GLIBC_2.3.3
GLIBC_2.3.4
GLIBC_2.4
GLIBC_2.7
GLIBC_2.9
GLIBCXX_3.4
GLIBCXX_3.4.11
GLIBCXX_3.4.15
GLIBCXX_3.4.9

Updating your system should help (and is recommended anyway). I also noted that your kernel is fairly outdated (almost a year). See https://rhn.redhat.com/errata/RHSA-2016-0450.html

eugeneglova commented 7 years ago

ok, thanks