Page MenuHomePhabricator

Installing npm package phantomjs-prebuilt failing for WikibaseJavaScriptApi builds
Closed, ResolvedPublic

Description

I might be panicking and it might be just a temporary glitch. Nonetheless, I noticed today morning npm jenkins jobs for patches in extensions/WikibaseJavaScriptApi are failing.
See e.g. failures for https://gerrit.wikimedia.org/r/#/c/387079 or https://gerrit.wikimedia.org/r/#/c/387773

I wonder whether this is somehow related to the recent switch to docker containers for npm jobs?

Possibly relevant part of npm-debug.log below:

64684 silly install phantomjs-prebuilt@2.1.15 /src/node_modules/.staging/phantomjs-prebuilt-e66e8660
64685 info lifecycle phantomjs-prebuilt@2.1.15~install: phantomjs-prebuilt@2.1.15
64686 verbose lifecycle phantomjs-prebuilt@2.1.15~install: unsafe-perm in lifecycle true
64687 verbose lifecycle phantomjs-prebuilt@2.1.15~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/src/node_modules/phantomjs-prebuilt/node_modules/.bin:/src/node_modules/.bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
64688 verbose lifecycle phantomjs-prebuilt@2.1.15~install: CWD: /src/node_modules/phantomjs-prebuilt
64689 silly lifecycle phantomjs-prebuilt@2.1.15~install: Args: [ '-c', 'node install.js' ]
64690 silly lifecycle phantomjs-prebuilt@2.1.15~install: Returned: code: 1 signal: null
64691 info lifecycle phantomjs-prebuilt@2.1.15~install: Failed to exec install script
64692 verbose unlock done using /cache/_locks/staging-1a14545af9ac12d4.lock for /src/node_modules/.staging
64693 silly rollbackFailedOptional Starting
64694 silly rollbackFailedOptional Finishing
64695 silly runTopLevelLifecycles Starting
64696 silly runTopLevelLifecycles Finishing
64700 verbose stack Error: phantomjs-prebuilt@2.1.15 install: node install.js
64700 verbose stack Exit status 1
64700 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:239:16)
64700 verbose stack at emitTwo (events.js:106:13)
64700 verbose stack at EventEmitter.emit (events.js:191:7)
64700 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
64700 verbose stack at emitTwo (events.js:106:13)
64700 verbose stack at ChildProcess.emit (events.js:191:7)
64700 verbose stack at maybeClose (internal/child_process.js:891:16)
64700 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
64701 verbose pkgid phantomjs-prebuilt@2.1.15
64702 verbose cwd /src
64703 error Linux 4.9.0-0.bpo.3-amd64
64704 error argv "/usr/bin/nodejs" "/usr/local/bin/npm" "install" "--no-progress"
64705 error node v6.11.0
64706 error npm v3.8.3
64707 error code ELIFECYCLE
64708 error phantomjs-prebuilt@2.1.15 install: node install.js
64708 error Exit status 1
64709 error Failed at the phantomjs-prebuilt@2.1.15 install script 'node install.js'.
64709 error Make sure you have the latest version of node.js and npm installed.
64709 error If you do, this is most likely a problem with the phantomjs-prebuilt package,
64709 error not with npm itself.
64709 error Tell the author that this fails on your system:
64709 error node install.js
64709 error You can get information on how to open an issue for this project with:
64709 error npm bugs phantomjs-prebuilt
64709 error Or if that isn't available, you can get their info via:
64709 error npm owner ls phantomjs-prebuilt
64709 error There is likely additional logging output above.
64710 verbose exit [ 1, true ]

Details

Related Gerrit Patches:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptNov 1 2017, 8:41 AM
hashar added a subscriber: hashar.Nov 1 2017, 10:37 AM

The root cause is the tarball is compressed with bzip2 and the Docker container lacks /usr/bin/bz2.

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

PhantomJS not found on PATH
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...
  [] 0%
Received 22866K total.
Extracting tar contents (via spawned process)
Error extracting archive
Phantom installation failed { Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
tar (child): bzip2: Cannot exec: No such file or directory

I had a similar issue when migrating jobs to Nodepool instances, specially the job running the selenium tests (T137112). From that task:

Just found out that PhantomJS 2.1.1 is available in jessie-backports since March 8th!!! https://packages.debian.org/jessie-backports/phantomjs
https://gerrit.wikimedia.org/r/#/c/344613/

We should either:

A) add phantomjs to the wmfreleng/npm-test container and phantomjs-prebuilt would be able to find it. The node module dependency might have to be changed to match the Debian package version (2.1.1). https://packages.debian.org/search?keywords=phantomjs

B) create a different container that extends npm-test and would support PhantomJS / Chromium and with Xvfb. There is T179360

Other repositories that might be affected:

  • mediawiki/selenium
  • oojs/ui
  • unicodejs
  • wikimedia-portals

Change 387780 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/config@master] Move npm for WikibaseJavaScriptApi back to Nodepool

https://gerrit.wikimedia.org/r/387780

Change 387780 merged by jenkins-bot:
[integration/config@master] Move npm for WikibaseJavaScriptApi back to Nodepool

https://gerrit.wikimedia.org/r/387780

So WikibaseJavaScriptApi is fixed now, as such this task is fixed.

Then it is all about whether we include PhantomJS in wmfreleng/npm-test or switch to a new containers (T179360).

Thanks @hashar! So could this be closed or do you want to use it for tracking making this decision?

hashar closed this task as Resolved.Nov 1 2017, 1:34 PM
hashar claimed this task.

Yup we can follow up on T179360