question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled rejection TypeError: Cannot read property '0.0.3' of undefined

See original GitHub issue

After a local node/npm update, it’s impossible to use the register.

I’m using filesystem storage.

Current node/npm version:

$ node -v                                                                       
v8.1.2
$ npm -v
6.3.0

If I run a npm info command I receive an error:

$ npm info @my-org/npm-package-example --registry http://my-server-ip-address --verbose
npm info it worked if it ends with ok
npm verb cli [ '/Users/alessandro/.nvm/versions/node/v8.1.2/bin/node',
npm verb cli   '/Users/alessandro/.nvm/versions/node/v8.1.2/bin/npm',
npm verb cli   'info',
npm verb cli   '@my-org/npm-package-example',
npm verb cli   '--registry',
npm verb cli   'http://my-server-ip-address',
npm verb cli   '--verbose' ]
npm info using npm@6.3.0
npm info using node@v8.1.2
npm verb request uri http://my-server-ip-address/@my-org%2fnpm-package-example
npm verb request no auth needed
npm info attempt registry request try #1 at 17:52:14
npm verb request using bearer token for auth
npm verb request id 12629f31ea6a79ac
npm http request GET http://my-server-ip-address/@my-org%2fnpm-package-example
npm http 200 http://my-server-ip-address/@my-org%2fnpm-package-example
npm verb headers { 'x-powered-by': 'Express',
npm verb headers   etag: '0.7451181132695863',
npm verb headers   'cache-control': 'public, max-age=60',
npm verb headers   'content-type': 'application/json; charset=utf-8',
npm verb headers   vary: 'Accept-Encoding',
npm verb headers   'content-encoding': 'gzip',
npm verb headers   date: 'Wed, 08 Aug 2018 15:52:16 GMT',
npm verb headers   connection: 'keep-alive',
npm verb headers   'transfer-encoding': 'chunked' }
npm verb stack TypeError: Cannot read property '0.0.3' of undefined
npm verb stack     at BB.try (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:222:57)
npm verb stack     at tryCatcher (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
npm verb stack     at Function.Promise.attempt.Promise.try (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/bluebird/js/release/method.js:39:29)
npm verb stack     at prettyView (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:186:16)
npm verb stack     at BB.all.results.map (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:173:35)
npm verb stack     at Array.map (native)
npm verb stack     at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:173:24
npm verb stack     at f (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/once/once.js:25:25)
npm verb stack     at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:78:16
npm verb stack     at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:105:12
npm verb stack     at f (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/once/once.js:25:25)
npm verb stack     at RegClient.<anonymous> (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:311:12)
npm verb stack     at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:222:7
npm verb stack     at Gunzip.onEnd (zlib.js:130:5)
npm verb stack     at emitNone (events.js:110:20)
npm verb stack     at Gunzip.emit (events.js:207:7)
npm verb cwd /Users/alessandro/Dev/my-org/dashboard
npm verb Darwin 17.6.0
npm verb argv "/Users/alessandro/.nvm/versions/node/v8.1.2/bin/node" "/Users/alessandro/.nvm/versions/node/v8.1.2/bin/npm" "info" "@my-org/npm-package-example" "--registry" "http://my-server-ip-address" "--verbose"
npm verb node v8.1.2
npm verb npm  v6.3.0
npm ERR! Cannot read property '0.0.3' of undefined
npm verb exit [ 1, true ]
Unhandled rejection TypeError: Cannot read property '0.0.3' of undefined
    at BB.try (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:222:57)
    at tryCatcher (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/bluebird/js/release/method.js:39:29)
    at prettyView (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:186:16)
    at BB.all.results.map (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:173:35)
    at Array.map (native)
    at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/lib/view.js:173:24
    at f (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:78:16
    at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:105:12
    at f (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at RegClient.<anonymous> (/Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:311:12)
    at /Users/alessandro/.nvm/versions/node/v8.1.2/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:222:7
    at Gunzip.onEnd (zlib.js:130:5)
    at emitNone (events.js:110:20)
    at Gunzip.emit (events.js:207:7)

npm timing npm Completed in 2138ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/alessandro/.npm/_logs/2018-08-08T15_52_16_232Z-debug.log

Server log

1|npm-regi | TypeError: Cannot read property 'code' of undefined
1|npm-regi |     at allowed (/usr/lib/node_modules/npm-register/node_modules/http-call/lib/http.js:240:22)
1|npm-regi |     at HTTP._maybeRetry (/usr/lib/node_modules/npm-register/node_modules/http-call/lib/http.js:246:13)
1|npm-regi |     at HTTP._request (/usr/lib/node_modules/npm-register/node_modules/http-call/lib/http.js:207:25)
1|npm-regi |     at <anonymous>
1|npm-regi |     at process._tickDomainCallback (internal/process/next_tick.js:228:7)

If I downgrade my local node/npm to 8.0.0/5.0.0, everything works:

$ npm info @my-org/npm-package-example --registry http://my-server-ip-address --verbose
npm info it worked if it ends with ok
npm verb cli [ '/Users/alessandro/.nvm/versions/node/v8.0.0/bin/node',
npm verb cli   '/Users/alessandro/.nvm/versions/node/v8.0.0/bin/npm',
npm verb cli   'info',
npm verb cli   '@my-org/npm-package-example',
npm verb cli   '--registry',
npm verb cli   'http://my-server-ip-address',
npm verb cli   '--verbose' ]
npm info using npm@5.0.0
npm info using node@v8.0.0
npm verb request uri http://my-server-ip-address/@my-org%2fnpm-package-example
npm verb request no auth needed
npm info attempt registry request try #1 at 13:02:01
npm verb request using bearer token for auth
npm verb request id 031db07bdc554fca
npm http request GET http://my-server-ip-address/@my-org%2fnpm-package-example
npm http 200 http://my-server-ip-address/@my-org%2fnpm-package-example
npm verb headers { 'x-powered-by': 'Express',
npm verb headers   etag: '0.7451181132695863',
npm verb headers   'cache-control': 'public, max-age=60',
npm verb headers   'content-type': 'application/json; charset=utf-8',
npm verb headers   vary: 'Accept-Encoding',
npm verb headers   'content-encoding': 'gzip',
npm verb headers   date: 'Thu, 09 Aug 2018 11:02:02 GMT',
npm verb headers   connection: 'keep-alive',
npm verb headers   'transfer-encoding': 'chunked' }
 
{ name: '@my-org/npm-package-example',
  description: 'Private npm package',
  'dist-tags': { latest: '0.0.3' },
  versions: 
   [ '0.0.3',
     '1.0.1',
     '2.0.0',
     '2.0.1',
     '2.1.0',
     '2.1.1',
     '2.1.2',
     '2.1.4',
     '2.1.5',
     '2.1.6' ],
  etag: '0.7451181132695863',
  version: '0.0.3',
  main: 'index.js',
  scripts: { test: 'echo "Error: no test specified" && exit 1' },
  repository: 
   { type: 'git',
     url: 'git+https://github.com/my-org-io/npm-package-example.git' },
  author: '',
  license: 'ISC',
  bugs: { url: 'https://github.com/my-org-io/npm-package-example/issues' },
  homepage: 'https://github.com/my-org-io/npm-package-example#readme',
  readme: 'npm-package-example readme content',
  readmeFilename: 'README.md',
  dist: 
   { integrity: 'sha512-20Z8vHSUHyjpBGM8Oi1xeUUWCQRtKLz0esqHCcqxmfHhOx5bgLcGY8Ez9pOdA/rfXpd2wMNk3dLI6vWJWHdB8g==',
     shasum: '69048f400957d07de39de4d6524143886dc434ac',
     tarball: 'http://my-server-ip-address/@my-org/npm-package-example/-/@my-org/npm-package-example-0.0.3/69048f400957d07de39de4d6524143886dc434ac.tgz' } }

npm verb exit [ 0, true ]
npm info ok 

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

1reaction
dgautschcommented, Aug 9, 2018

@lifeisfoo i’ll have to investigate this evening. thanks for surfacing.

0reactions
lifeisfoocommented, Nov 6, 2018

Hi @dgautsch I’ve tested today v2.8.2, but I got the same error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled Rejection (TypeError): Cannot read property
You're dispatching an action with a wrong property name of paylaod (note the ao instead of oa) in your gamesAction.js and you're expecting...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
TypeError: Cannot read Property '0' of Undefined in JS
The "Cannot read property '0' of undefined" error occurs when trying to access the 0th index in a variable that stores an undefined...
Read more >
TypeError: Cannot read property 'startsWith' of undefined
On one function I get the following error message: "TypeError: Cannot read property 'startsWith' of undefined" What causes this message.
Read more >
[SOLVED] Cannot Read Property '0' of Undefined in JavaScript
The “cannot read property '0' of undefined” error occurs when you try to access the 0 index of an array-like variable, but the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found