garris/BackstopJS

v3.0.25 npm install failing on phantomjs

dgrant85 opened this issue · 11 comments

macOS 10.12.6
node -v v8.4.0
npm -v 5.4.1

Updated to latest version of backstopjs which fails at phantomjs. Relevant portion of log below.

I'll downgrade for now, but any idea what might be causing this?

16326 silly install phantomjs-prebuilt@2.1.15
16327 info lifecycle phantomjs-prebuilt@2.1.15~install: phantomjs-prebuilt@2.1.15
16328 verbose lifecycle phantomjs-prebuilt@2.1.15~install: unsafe-perm in lifecycle true
16329 verbose lifecycle phantomjs-prebuilt@2.1.15~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/davegrant/Sites/cipd/html/peoplemanagement/node_modules/phantomjs-prebuilt/node_modules/.bin:/Users/davegrant/Sites/cipd/html/peoplemanagement/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet
16330 verbose lifecycle phantomjs-prebuilt@2.1.15~install: CWD: /Users/davegrant/Sites/cipd/html/peoplemanagement/node_modules/phantomjs-prebuilt
16331 silly lifecycle phantomjs-prebuilt@2.1.15~install: Args: [ '-c', 'node install.js' ]
16332 silly lifecycle phantomjs-prebuilt@2.1.15~install: Returned: code: 1  signal: null
16333 info lifecycle phantomjs-prebuilt@2.1.15~install: Failed to exec install script
16334 verbose unlock done using /Users/davegrant/.npm/_locks/staging-849c7d926953bcc8.lock for /Users/davegrant/Sites/cipd/html/peoplemanagement/node_modules/.staging
16335 verbose stack Error: phantomjs-prebuilt@2.1.15 install: `node install.js`
16335 verbose stack Exit status 1
16335 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
16335 verbose stack     at emitTwo (events.js:125:13)
16335 verbose stack     at EventEmitter.emit (events.js:213:7)
16335 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
16335 verbose stack     at emitTwo (events.js:125:13)
16335 verbose stack     at ChildProcess.emit (events.js:213:7)
16335 verbose stack     at maybeClose (internal/child_process.js:927:16)
16335 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
16336 verbose pkgid phantomjs-prebuilt@2.1.15
16337 verbose cwd /Users/davegrant/Sites/cipd/html/peoplemanagement
16338 verbose Darwin 16.7.0
16339 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i"
16340 verbose node v8.4.0
16341 verbose npm  v5.4.1
16342 error code ELIFECYCLE
16343 error errno 1
16344 error phantomjs-prebuilt@2.1.15 install: `node install.js`
16344 error Exit status 1
16345 error Failed at the phantomjs-prebuilt@2.1.15 install script.
16345 error This is probably not a problem with npm. There is likely additional logging output above.
16346 verbose exit [ 1, true ]
tbal commented

Same here on Ubuntu 17.04 with node v8.9.0 and npm 5.5.1 trying to install BackstopJS v3.0.32.

Hmmm. No idea. This is not an issue for most users so I am guessing it’s an env issue.

Maybe you could try doing a verbose install of phantom-prebuilt by its self — maybe that would turn up some clues?

Hello All,

Same here.
But I have already install the phantomJS, the backstopJS will failed to write location.js file.

System Info:
node version: v8.9.1
npm version: 5.5.1
Linux: Centos 7 with https://rpm.nodesource.com/pub_8.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm

Would you please take time to see it?

Thank you,
Ken

`Installing BackstopJS v3.0.25...
/usr/bin/backstop -> /usr/lib/node_modules/backstopjs/cli/index.js

phantomjs-prebuilt@2.1.16 install /usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt
node install.js

Considering PhantomJS found at /usr/bin/phantomjs
Found PhantomJS at /usr/bin/phantomjs ...verifying
Writing location.js file
Error checking path, continuing { Error: EACCES: permission denied, open '/usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt/lib/location.js'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.writeFileSync (fs.js:1291:33)
at writeLocationFile (/usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt/lib/util.js:84:6)
at Promise._successFn (/usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt/install.js:375:11)
at nextTickCallback (/usr/lib/node_modules/backstopjs/node_modules/kew/kew.js:47:28)
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt/lib/location.js' }
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...

Received 22866K total.
Extracting tar contents (via spawned process)
Removing /usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1510129726637/phantomjs-2.1.1-linux-x86_64 -> /usr/lib/node_modules/backstopjs/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-1510129726637/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/backstopjs/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-1510129726637/phantomjs-2.1.1-linux-x86_64',
dest: '/usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1510129726637/phantomjs-2.1.1-linux-x86_64' -> '/usr/lib/node_modules/backstopjs/node_modules/phantomjs-prebuilt/lib/phantom'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.16 install: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 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! /headless/.npm/_logs/2017-11-08T08_28_52_880Z-debug.log
The command '/bin/sh -c echo "Installing BackstopJS v${BACKSTOPJS_VERSION}..." && npm config set registry http://registry.npmjs.org/ && chmod -R 777 /usr/lib/node_modules/ && npm install -g backstopjs@${BACKSTOPJS_VERSION} && ln -s /usr/lib/node_modules /usr/bin/' returned a non-zero code: 1`

I found the followings:
https://docs.npmjs.com/getting-started/fixing-npm-permissions
npm/npm#8165

Hope could help others.

For mine, I use the node6.x, and npm3.x to install the backstopjs v3.0.25 on centos7 (yum install nodejs).
Then update the node6.x -> 8.9.1, npm3.x -> npm 5.5.1
Tested, it is okay.

tbal commented

I fixed it by setting user/group of /usr/lib/node_modules/ (OS: Ubuntu 17.04) to my user and install BackstopJS globally without sudo:

$ sudo chown -R $(id -u):$(id -g) /usr/lib/node_modules/
$ npm install -g backstopjs

No BackstopJS problem, but a npm/phantomJS one..

@tbal Thank you, it works if not installing as root! Thank you!

Camru commented

Using the same example as @tbal on OSX, I had to use:

$ sudo chown -R $(id -u):$(id -g) /usr/local/lib/node_modules/
$ npm install -g backstopjs

Try the following.
For more info, please refer to: npm/npm#17851 (comment)

npm config set user 0
npm config set unsafe-perm true

npm install

I followed the instructions set out by @Kenith and this did the trick.

@garris I am encountering this issue currently. It might be due to proxy issues. However, I was thinking, should we just have a release where puppeteer is the only engine?

Hi @marcdacz -- phantom has been removed from the next release. Would be great if some people could validate the canary...

npm install -g backstopjs@canary

Cheers.