npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Issue: `npm dedupe` crash with "TypeError: Cannot read property '0' of undefined"

What I Wanted to Do

Run npm dedupe

What Happened Instead

As in the referenced GitHub bug that I couldn’t find duplicated here, I got a CLI error message partly reading
“(node:27816) UnhandledPromiseRejectionWarning: TypeError: Cannot read property ‘0’ of undefined”

Reproduction Steps

npm install --no-optional && npm dedupe

Platform Info

$ npm --versions
{ '{text-omitted}': '1.0.0',
  npm: '6.2.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

This is intermittent for me.
It may or may not be related to fetching packages from an artifactory repo.

Even when I have everything cached, it sometimes happens.

I get the same error when it fails to post back to an internal NPM repo:

36 info lifecycle undefined~preuninstall: undefined
37 info lifecycle undefined~uninstall: undefined
38 timing audit compress Completed in 22ms
39 info audit Submitting payload of 50916bytes
40 http fetch POST 400 610ms
41 timing npm Completed in 15345ms
42 error cb() never called!
43 error This is an error with npm itself. Please report this error at:
44 error <>

I appear to have reported the same bug.