Medium / phantomjs

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

Install fails under Node 8.x + Ubuntu 16.04 #747

Open hyperknot opened 6 years ago

hyperknot commented 6 years ago

Install fails under Ubuntu 16.04 + Node 8.x. Works perfectly under Node 6.x under the same system.

npm install -g phantomjs-prebuilt
/usr/bin/phantomjs -> /usr/lib/node_modules/phantomjs-prebuilt/bin/phantomjs

> phantomjs-prebuilt@2.1.15 install /usr/lib/node_modules/phantomjs-prebuilt
> node install.js

Considering PhantomJS found at /usr/bin/phantomjs
Looks like an `npm install -g`
Could not link global install, skipping...
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Receiving...
  [=====================================---] 93%
Received 22866K total.
Extracting tar contents (via spawned process)
Removing /usr/lib/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1507240449498/phantomjs-2.1.1-linux-x86_64 -> /usr/lib/node_modules/phantomjs-prebuilt/lib/phantom
Phantom installation failed { Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1507240449498/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom'
  errno: -13,
  code: 'EACCES',
  syscall: 'link',
  path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1507240449498/phantomjs-2.1.1-linux-x86_64',
  dest: '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1507240449498/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/phantomjs-prebuilt/lib/phantom'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.15 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.15 install 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/2017-10-05T21_54_13_430Z-debug.log

Node was installed on Ubuntu 16.04 using the official docs:

curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
    apt-get update && apt-get install -y --no-install-recommends nodejs

Changing 8.x to 6.x in the above command makes it work perfectly.

hyperknot commented 6 years ago

Installing it using

yarn global add phantomjs-prebuilt

Instead of npm on Node 8.x make it work, but apt-get install libfontconfig needs to be run in that case as well.

Jinkxed commented 6 years ago

@hyperknot You rock thanks!

tigercosmos commented 6 years ago

Same error happen on macOS with nodev9.2

arondeparon commented 6 years ago

Same issue here on Ubuntu 16.

Foorack commented 5 years ago

Experiencing this on ubuntu 18.04 with npm 6.4.1 and node 10.12.0