Page MenuHomePhabricator

MediaWiki-Vagrant does not install bluebird package
Closed, ResolvedPublic


Bluebird is mwbot dependency, introduced in 417848.

Reproducible in MediaWiki-Vagrant:

user@machine:/mediawiki/vagrant$ vagrant ssh

vagrant@vagrant:~$ node -v

vagrant@vagrant:~$ npm -v

vagrant@vagrant:~$ cd /vagrant/mediawiki

vagrant@vagrant:/vagrant/mediawiki$ rm -rf node_modules/

vagrant@vagrant:/vagrant/mediawiki$ npm install

vagrant@vagrant:/vagrant/mediawiki$ xvfb-run npm run selenium
[chrome #0-0] Spec: /vagrant/mediawiki/tests/selenium/specs/page.js
[chrome #0-0] Running: chrome
[chrome #0-0]
[chrome #0-0]   Page
[chrome #0-0]
[chrome #0-0]   Page
[chrome #0-0]       ✓ should be creatable
[chrome #0-0]       1) should be re-creatable
[chrome #0-0]       2) should have history
[chrome #0-0]
[chrome #0-0]
[chrome #0-0] 1 passing (12s)
[chrome #0-0] 5 failing
[chrome #0-0]
[chrome #0-0] 1) Page should be re-creatable:
[chrome #0-0] Cannot find module 'bluebird'
Warning: Task "webdriver:test" failed. Use --force to continue.
Aborted due to warnings.

Not reproducible on my desktop machine, probably because it has a newer npm version:

$ node -v

$ npm -v

$ rm -rf node_modules/

$ npm install

$ npm run selenium
(no errors)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 28 2018, 10:13 AM
zeljkofilipin triaged this task as Medium priority.Mar 28 2018, 10:13 AM
zeljkofilipin renamed this task from Cannot find module 'bluebird' to Cannot find module 'bluebird'.Mar 28 2018, 10:16 AM
zeljkofilipin renamed this task from Cannot find module 'bluebird' to MediaWiki-Vagrant does not install bluebird package.
zeljkofilipin updated the task description. (Show Details)

Change 422385 had a related patch set uploaded (by Zfilipin; owner: Zfilipin):
[mediawiki/core@master] Selenium: install bluebird, mwbot dependency

Change 422385 merged by jenkins-bot:
[mediawiki/core@master] Selenium: install bluebird, mwbot dependency

zeljkofilipin closed this task as Resolved.Mar 28 2018, 1:53 PM
zeljkofilipin awarded a token.
zeljkofilipin rescinded a token.
zeljkofilipin awarded a token.

@zeljkofilipin For future reference, mwbot's dependency was not missing. Bluebird was installed. If it wasn't, npm would be very badly broken and the test would've failed much earlier.

The problem was that our own code was using it directly, and we didn't specify a dependency.

Node sometimes exposes a module's dependencies wider than strictly needed as a way to optimise and reduce depth of the dependency tree. But this is purely an optimisation and not something to rely on.

Upstream could trivially switch out Bluebird for another Promise library, or for a newer or older version that isn't compatible with what we do in our own code. If and when that happens, package.json will make sure that our code still has the dependencies and versions we need.

And yes, that means sometimes we run with the same library installed multiple times (different versions). This may feel strange a first, but is a feature enabled by Node.js resolving node_modules to the first match, starting in the current directory, moving upwards. This is stable and documented behaviour, used and relied on by many packages :)