Page MenuHomePhabricator

`npm install` fails for mediawiki/core with EPEERINVALID when running on Node 11
Closed, ResolvedPublic

Description

TLDR:

  • all software is up to date (vagrant, virtualbox)
  • all repositories are up to date (mediawiki/vagrant, mediawiki/core)
  • mediawiki-vagrant VM is just created
  • npm install fails
$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.13.6
BuildVersion:	17G3025

$ vboxmanage --version
5.2.22r126460

$ vagrant -v
Vagrant 2.2.1

$ cd mediawiki/vagrant

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

$ git log -1
commit 5cb79d7ab3d04d5a950cdbdbb4bdf562774f4c32 (HEAD -> master, origin/master, origin/HEAD)
Author: Gergő Tisza <gtisza@wikimedia.org>
Date:   Thu Nov 15 14:16:14 2018 -0800

    Fix git-review
    
    Vagrant uses legacy /r/p repo URLs bug git-review 1.26+ expects /r
    (and older git-review is broken in a different way).
    
    Does not fix existing repos which Vagrant already cloned
    with the /r/p remote path.
    
    Bug: T163242
    Change-Id: I548ee4307b9cf9c6342cf9b9c9c1f225b74c24aa

$ vagrant roles list -e
Enabled roles:
(no roles)

$ vagrant status
Current machine states:
default                   not created (virtualbox)
...

$ vagrant up
...
(no problems)

$ vagrant ssh

$ node -v
v6.14.4

$ npm -v
2.15.12

$ cd /vagrant/mediawiki

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean

$ git log -1
commit 32542f66db7821660d3683e74a572ec3ab1e76f2
Merge: 1c04b7ae61 dd70d9e71f
Author: jenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Date:   Tue Nov 27 14:36:30 2018 +0000

    Merge "Preferences: Remove unused message for RC/Watchlist opt-out section"

$ rm -rf node_modules/

$ npm install
npm WARN peerDependencies The peer dependency karma@^0.13.0 || ^1.0.0 included from grunt-karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN optional dep failed, continuing fsevents@1.2.4
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN optional dep failed, continuing fsevents@1.2.4
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
 
> fibers@2.0.2 install /vagrant/mediawiki/node_modules/wdio-mocha-framework/node_modules/wdio-sync/node_modules/fibers
> node build.js || nodejs build.js

`linux-x64-48` exists; testing
Binary is fine; exiting
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated boom@4.3.1: This version is no longer maintained. Please upgrade to the latest version.
-
> sauce-connect-launcher@1.2.4 postinstall /vagrant/mediawiki/node_modules/wdio-sauce-service/node_modules/sauce-connect-launcher
> node scripts/install.js || nodejs scripts/install.js

npm ERR! Linux 4.9.0-8-amd64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i"
npm ERR! node v6.14.4
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package karma@3.0.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-karma@3.0.0 wants karma@^0.13.0 || ^1.0.0
npm ERR! peerinvalid Peer karma-mocha-reporter@2.2.5 wants karma@>=0.13

npm ERR! Please include the following file with any support request:
npm ERR!     /vagrant/mediawiki/npm-debug.log

Event Timeline

zeljkofilipin renamed this task from `npm install` fails for mediawiki/core with `EPEERINVALID` when running from mediawiki-vagrant VM to `npm install` fails for mediawiki/core with EPEERINVALID when running from mediawiki-vagrant VM.Nov 27 2018, 3:10 PM
zeljkofilipin updated the task description. (Show Details)

The reason I'm running from mediawiki-vagrant VM is because npm install fails on my machine, probably because of node and/or npm version(s).

$ node -v
v11.2.0

$ npm -v
6.4.1

$ npm install
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.

> fibers@2.0.2 install /Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/fibers
> node build.js || nodejs build.js

  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:318:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
                object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallba...
                ^~~~~~~~~~~~~~~~~~~
../src/fibers.cc:464:24: warning: 'Utf8Value' is deprecated: Use Isolate version [-Wdeprecated-declarations]
                                        String::Utf8Value stack(uni::Deref(that.isolate, fatal_stack));
                                                          ^
/Users/z/.node-gyp/11.2.0/include/node/v8.h:2991:5: note: 'Utf8Value' has been explicitly marked deprecated here
    V8_DEPRECATED("Use Isolate version",
    ^
/Users/z/.node-gyp/11.2.0/include/node/v8config.h:326:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
../src/fibers.cc:686:66: error: too few arguments to function call, expected at least 2, have 1
                                Script::Compile(uni::NewLatin1String(that.isolate, "void 0;"));
                                ~~~~~~~~~~~~~~~                                              ^
/Users/z/.node-gyp/11.2.0/include/node/v8.h:1359:3: note: 'Compile' declared here
  static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
  ^
../src/fibers.cc:701:66: error: too few arguments to function call, single argument 'context' was not specified
                                                uni::Reset(that.isolate, fatal_stack, try_catch.StackTrace());
                                                                                      ~~~~~~~~~~~~~~~~~~~~ ^
/Users/z/.node-gyp/11.2.0/include/node/v8.h:8878:3: note: 'StackTrace' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
  ^
/Users/z/.node-gyp/11.2.0/include/node/v8config.h:418:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
2 warnings and 2 errors generated.
make: *** [Release/obj.target/fibers/src/fibers.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/11.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/fibers
gyp ERR! node -v v11.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
Alpine users please run: `sudo apk add python make g++`
  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:318:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
                object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallba...
                ^~~~~~~~~~~~~~~~~~~
../src/fibers.cc:464:24: warning: 'Utf8Value' is deprecated: Use Isolate version [-Wdeprecated-declarations]
                                        String::Utf8Value stack(uni::Deref(that.isolate, fatal_stack));
                                                          ^
/Users/z/.node-gyp/11.2.0/include/node/v8.h:2991:5: note: 'Utf8Value' has been explicitly marked deprecated here
    V8_DEPRECATED("Use Isolate version",
    ^
/Users/z/.node-gyp/11.2.0/include/node/v8config.h:326:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated(message)))
                            ^
../src/fibers.cc:686:66: error: too few arguments to function call, expected at least 2, have 1
                                Script::Compile(uni::NewLatin1String(that.isolate, "void 0;"));
                                ~~~~~~~~~~~~~~~                                              ^
/Users/z/.node-gyp/11.2.0/include/node/v8.h:1359:3: note: 'Compile' declared here
  static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile(
  ^
../src/fibers.cc:701:66: error: too few arguments to function call, single argument 'context' was not specified
                                                uni::Reset(that.isolate, fatal_stack, try_catch.StackTrace());
                                                                                      ~~~~~~~~~~~~~~~~~~~~ ^
/Users/z/.node-gyp/11.2.0/include/node/v8.h:8878:3: note: 'StackTrace' declared here
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace(
  ^
/Users/z/.node-gyp/11.2.0/include/node/v8config.h:418:31: note: expanded from macro 'V8_WARN_UNUSED_RESULT'
#define V8_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
                              ^
2 warnings and 2 errors generated.
make: *** [Release/obj.target/fibers/src/fibers.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/Cellar/node/11.2.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/fibers
gyp ERR! node -v v11.2.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
Alpine users please run: `sudo apk add python make g++`
npm WARN grunt-karma@3.0.0 requires a peer of karma@^0.13.0 || ^1.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fibers@2.0.2 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fibers@2.0.2 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!     /Users/z/.npm/_logs/2018-11-27T15_16_25_593Z-debug.log

Works fine (with some warnings) on Node 10.

$ brew rm -f node
Uninstalling node... (103,828 files, 1GB)

$ brew install node@10
...

$ echo 'export PATH="/usr/local/opt/node@10/bin:$PATH"' >> ~/.bash_profile

$ source ~/.bash_profile

$ node -v
v10.13.0

$ npm -v
6.4.1

$ rm -rf node_modules/

$ npm install
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.

> fibers@2.0.2 install /Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/fibers
> node build.js || nodejs build.js

  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:318:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
                object->SetAccessor(isolate->GetCurrentContext(), name, (AccessorNameGetterCallback)getter, (AccessorNameSetterCallba...
                ^~~~~~~~~~~~~~~~~~~
../src/fibers.cc:464:24: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
                                        String::Utf8Value stack(uni::Deref(that.isolate, fatal_stack));
                                                          ^
/Users/z/.node-gyp/10.13.0/include/node/v8.h:2891:5: note: 'Utf8Value' has been explicitly marked deprecated here
    V8_DEPRECATED("Use Isolate version",
    ^
/Users/z/.node-gyp/10.13.0/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/fibers.cc:686:13: warning: 'Compile' is deprecated [-Wdeprecated-declarations]
                                Script::Compile(uni::NewLatin1String(that.isolate, "void 0;"));
                                        ^
/Users/z/.node-gyp/10.13.0/include/node/v8.h:1255:10: note: 'Compile' has been explicitly marked deprecated here
  static V8_DEPRECATED("Use maybe version",
         ^
/Users/z/.node-gyp/10.13.0/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
../src/fibers.cc:701:55: warning: 'StackTrace' is deprecated [-Wdeprecated-declarations]
                                                uni::Reset(that.isolate, fatal_stack, try_catch.StackTrace());
                                                                                                ^
/Users/z/.node-gyp/10.13.0/include/node/v8.h:8593:3: note: 'StackTrace' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version.", Local<Value> StackTrace() const);
  ^
/Users/z/.node-gyp/10.13.0/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
  declarator __attribute__((deprecated))
                            ^
4 warnings generated.
  CXX(target) Release/obj.target/fibers/src/coroutine.o
  CC(target) Release/obj.target/fibers/src/libcoro/coro.o
  SOLINK_MODULE(target) Release/fibers.node
Installed in `/Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/fibers/bin/darwin-x64-64/fibers.node`

> fsevents@1.2.4 install /Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/fsevents
> node install

[fsevents] Success: "/Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> sauce-connect-launcher@1.2.4 postinstall /Users/z/Documents/gerrit/mediawiki/vagrant/mediawiki/node_modules/sauce-connect-launcher
> node scripts/install.js || nodejs scripts/install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN grunt-karma@3.0.0 requires a peer of karma@^0.13.0 || ^1.0.0 but none is installed. You must install peer dependencies yourself.

added 945 packages from 1469 contributors and audited 8081 packages in 28.951s
found 0 vulnerabilities

Just encountered this myself on my main dev machine (outside vagrant).

Jdforrester-WMF renamed this task from `npm install` fails for mediawiki/core with EPEERINVALID when running from mediawiki-vagrant VM to `npm install` fails for mediawiki/core with EPEERINVALID when running on Node 11.Mar 26 2019, 6:51 PM

Change 499307 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@master] build: Upgrade webdriverio-related tools to latest

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

This task got forked at some point. The Title and task description state:

npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package karma@3.0.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-karma@3.0.0 wants karma@^0.13.0 || ^1.0.0
npm ERR! peerinvalid Peer karma-mocha-reporter@2.2.5 wants karma@>=0.13

Which really I don't know why it failed at the time but probably got fixed since then.

Then the other replies are about fibers@2.0.x failing to install on NodeJS 11.

So that is confusing. Really -:-]

There might be two unrelated problems. I'll investigate.

TLDR: npm i fails for mediawiki/core in both node 11 (initial release 11.0.0 2018-10-23, current release 11.12.0 2019-03-15, what you currently get with brew install node) and node 6 (inital release 6.0.0 2016-04-26, current release 6.16.0 2018-12-26, what you currently get in mediawiki-vagrant).

Seems it is just that fibers 2.x does not support NodeJS 11, and probably does not on Node JS 6 either because that is an older version and fiber 2.x broke support for it.

You can easily test by doing for each NodeJS version you have:

npm install fibers@2
npm install fibers@3

I got NodeJS 8.11 from Debian Stretch and both works fine:

$ npm install fibers@2

> fibers@2.0.2 install /tmp/node_modules/fibers
> node build.js || nodejs build.js

`linux-x64-57` exists; testing
Binary is fine; exiting
/tmp
└── fibers@2.0.2 



$ npm install fibers@3

> fibers@3.1.1 install /tmp/node_modules/fibers
> node build.js || nodejs build.js
`linux-x64-57-glibc` exists; testing
Binary is fine; exiting
/tmp
└─┬ fibers@3.1.1 
  └── detect-libc@1.0.3

Or in other terms, fibers depends on NodeJS/node-gyp ABI?! :]

Also https://github.com/laverdet/node-fibers/blob/master/README.md#supported-platforms

  • If you are running nodejs version 8.x or 10.x on Linux, OS X, or Windows (7 or later) then you should be able to install fibers from npm just fine.
  • If you are running nodejs v6.x then you will need to use npm install fibers@2.
  • For nodejs v4.x you can use npm install fibers@1. If you are running an older (or newer) version of node or some other operating system you will have to compile fibers on your system.

Or to repeat: fibers@3 requires NodeJS 8 and later, fibers@2 is only support fore NodeJS 6.

mediawiki/coremaster (fibers@2.0.2)499307 (fibers@3.1.1)
node 6.11.0 + npm 3.8.3 (CI)1163411635ELIFECYCLE
node 6.16.0 + npm 2.15.12 (mediawiki-vagrant)P8304EPEERINVALIDP8302EPEERINVALID
node 11.12.0 + npm 6.9.0 (current version)P8303ELIFECYCLEP8301

Could be resolved by T213268. New version of webdriverio has completely different dependencies.

Change 511010 had a related patch set uploaded (by Zfilipin; owner: 01tonythomas):
[mediawiki/extensions/Newsletter@master] Selenium: change versions of webdriverio related packages

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

Change 511010 merged by jenkins-bot:
[mediawiki/extensions/Newsletter@master] Selenium: change versions of webdriverio related packages

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

Jdforrester-WMF claimed this task.

This should now be fixed, by using wdio-async 0.6.4 which pulls in fibres 3.1.1. We didn't need to bump selenium to v5 after all.

Change 499307 abandoned by Jforrester:
build: Upgrade webdriverio-related tools to latest

Reason:
Done elsewise.

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