Skip to content

versionPkg() throws "Cannot read property 'latest' of undefined" #1

Description

@bokub

Hi,
While running npm-name-cli, I got the following error:

npm-name --version
> 2.3.0

npm-name sunglasses
> TypeError: Cannot read property 'latest' of undefined
>    at versionPkg (/usr/local/lib/node_modules/npm-name-cli/node_modules/squatter/lib/get->package.js:9:36)
>    at squatter (/usr/local/lib/node_modules/npm-name-cli/node_modules/squatter/index.js:42:17)
>    at process._tickCallback (internal/process/next_tick.js:68:7)

which points to the following line of code :

    const fixed = meta['dist-tags'][version] // version = 'latest'

I logged meta I and I got the following result:

{ _id: 'sunglasses',
  _rev: '2-120e55f8b26a7ff42558a6baf3f1d868',
  name: 'sunglasses',
  time:
   { modified: '2016-04-28T00:32:39.237Z',
     created: '2016-04-28T00:32:39.237Z',
     '0.0.0-reserved': '2016-04-28T00:32:39.237Z',
     unpublished:
      { name: 'npm',
        time: '2016-06-10T22:41:14.482Z',
        tags: [Object],
        maintainers: [Array],
        versions: [Array] } },
  _attachments: {} }

There is no dist-tags in the meta.

I thinks the package has been unpublished, so it might be good to handle that case

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions