"npm install" and "npm upgrade" are failing with node version 8.11.3

cli
help-wanted
priority:medium
triaged

(Miten Mehta) #1

What I Wanted to Do

We are using node js with npm modules. So before building our projects, we execute “npm install” or “npm upgrade” depending on whether we are using our CI machine or dev machine.

What Happened Instead

Lately when we upgraded to node js version 8.11.3, we have started seeing these commands result into failures (not always but frequency has increased. Yesterday they failed on all of our machines)

Reproduction Steps

Not able to share our repository but have attached the verbose log file.

Details

we have Linux, mac and windows machines and all of them are seeing the issue. Errors we get when we run npm install and npm upgrade commands are:

typeerror Error: Argument #2: Expected string or string but got null

Note that we tried to add more logs but as a new user, system only allows me to upload 1 attachment. Contact me if you need more.

2018-08-06T18_53_37_394Z-debug.log (116.5 KB)

Platform Info

$ npm --versions
<!-- paste output here -->
{ journal: '0.0.1',
  npm: '6.3.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.11.3',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }

{ journal: '0.0.1',
  npm: '6.1.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.11.3',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }

$ node -p process.platform
<!-- paste output here -->
Linux (on one machine)
Darwin (on 2nd one) 


(Brian Olore) #2

Just some triage info - from the attached log:

689 http fetch GET 304 https://registry.npmjs.org/macaddress 61ms (from cache)
690 silly pacote range manifest for macaddress@^0.2.8 fetched in 64ms
691 silly resolveWithNewModule macaddress@0.2.9 checking installable status
692 verbose stack Error: Argument #2: Expected string or string but got null
692 verbose stack     at fetchPackageMetadata (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/fetch-package-metadata.js:36:3)
692 verbose stack     at limited (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/call-limit/call-limit.js:29:10)
692 verbose stack     at addDependency (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:572:5)
692 verbose stack     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:498:5
692 verbose stack     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
692 verbose stack     at Array.forEach (<anonymous>)
692 verbose stack     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
692 verbose stack     at Array.forEach (<anonymous>)
692 verbose stack     at asyncMap (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
692 verbose stack     at loadDeps (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:496:3)
692 verbose stack     at Array.<anonymous> (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
692 verbose stack     at LOOP (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
692 verbose stack     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7
692 verbose stack     at Function.module.exports.now (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/and-finish-tracker.js:15:6)
692 verbose stack     at loadDeps (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:493:99)
692 verbose stack     at Array.<anonymous> (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
693 verbose cwd /Users/miten/src/resservices/journals
694 verbose Darwin 16.1.0
695 verbose argv "/Users/miten/.nvm/versions/node/v8.11.3/bin/node" "/Users/miten/.nvm/versions/node/v8.11.3/bin/npm" "upgrade"
696 verbose node v8.11.3
697 verbose npm  v6.1.0
698 error code EINVALIDTYPE
699 error typeerror Error: Argument #2: Expected string or string but got null
699 error typeerror     at fetchPackageMetadata (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/fetch-package-metadata.js:36:3)
699 error typeerror     at limited (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/call-limit/call-limit.js:29:10)
699 error typeerror     at addDependency (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:572:5)
699 error typeerror     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:498:5
699 error typeerror     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:35
699 error typeerror     at Array.forEach (<anonymous>)
699 error typeerror     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:52:11
699 error typeerror     at Array.forEach (<anonymous>)
699 error typeerror     at asyncMap (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/async-map.js:51:8)
699 error typeerror     at loadDeps (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:496:3)
699 error typeerror     at Array.<anonymous> (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
699 error typeerror     at LOOP (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:15:14)
699 error typeerror     at /Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/chain.js:18:7
699 error typeerror     at Function.module.exports.now (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/and-finish-tracker.js:15:6)
699 error typeerror     at loadDeps (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/lib/install/deps.js:493:99)
699 error typeerror     at Array.<anonymous> (/Users/miten/.nvm/versions/node/v8.11.3/lib/node_modules/npm/node_modules/slide/lib/bind-actor.js:15:8)
700 error typeerror This is an error with npm itself. Please report this error at:
700 error typeerror     <https://github.com/npm/npm/issues>
701 verbose exit [ 1, true ]

Seems to be failing on the line that validates the function’s args (36,3)

35 function fetchPackageMetadata (spec, where, opts, done) {
36   validate('SSOF|SSFZ|OSOF|OSFZ', [spec, where, opts, done])

I was unable to reproduce with the following (darwin)

$ npm --versions
{ underscore: '1.1.6',
  npm: '6.3.0',
  ares: '1.10.1-DEV',
  cldr: '32.0',
  http_parser: '2.8.0',
  icu: '60.1',
  modules: '57',
  napi: '3',
  nghttp2: '1.32.0',
  node: '8.11.3',
  openssl: '1.0.2o',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.19.1',
  v8: '6.2.414.54',
  zlib: '1.2.11' }

When you run npm install,

  1. Do you have a package-lock.json? Can you share it?
  2. Does node_modules/ exist? (did you try deleting it?)
  3. Maybe try deleting npm cache? npm cache clean --force

There are a few thoughts on other things to try in this older issue.