npm ERR! Cannot read property

cli

(Danny Levenson) #1

What I Wanted to Do

I tried to update a dependency by running: npm i lodash@latest --save (as an example).
npm spun for a few seconds and did nothing. Then I tried npm show lodash.

What Happened Instead

I got the following exception:

npm ERR! Cannot read property '4.17.10' of undefined
Unhandled rejection TypeError: Cannot read property '4.17.10' of undefined
    at BB.try (/usr/local/lib/node_modules/npm/lib/view.js:222:57)
    at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/method.js:39:29)
    at prettyView (/usr/local/lib/node_modules/npm/lib/view.js:186:16)
    at BB.all.results.map (/usr/local/lib/node_modules/npm/lib/view.js:173:35)
    at Array.map (<anonymous>)
    at /usr/local/lib/node_modules/npm/lib/view.js:173:24
    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:78:16
    at /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:105:12
    at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
    at RegClient.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:311:12)
    at /usr/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:222:7
    at Gunzip.onEnd (zlib.js:131:5)
    at emitNone (events.js:111:20)
    at Gunzip.emit (events.js:208:7)

4.17.10 happens to be the latest version of lodash. If I try running show for other modules, the unfound property name is whatever the current version is for the package I am running the show command on.

Reproduction Steps

I was able to reproduce this on a new directory that does not have a package file by simply running:

npm show lodash

Currently, I am able to get around this by installing npm 5.6.0 which is the version that a co-worker is running without any problems.

Details

Platform Info

$ npm --versions
{ npm: '6.2.0',
  ares: '1.10.1-DEV',
  cldr: '31.0.1',
  http_parser: '2.7.0',
  icu: '59.1',
  modules: '57',
  nghttp2: '1.25.0',
  node: '8.9.4',
  openssl: '1.0.2n',
  tz: '2017b',
  unicode: '9.0',
  uv: '1.15.0',
  v8: '6.1.534.50',
  zlib: '1.2.11' }
$ node -p process.platform
darwin

(Kat Marchán) #2

I couldn’t reproduce this myself on the same platform with the same npm version.

I suspect there’s a network or proxy issue going on, where you’re getting JSON back, but it’s not actually a package manifest. I’ve moved this to #support until there’s more information and configuration issues are ruled out.

Could you try doing npm show lodash --json and show me the output? I believe that one will succeed for you and at least give us a clue about what might be going on.


(Danny Levenson) #3
npm show lodash --json
{
  "name": "lodash",
  "versions": [
    "0.1.0",
    "0.2.0",
    "0.2.1",
    "0.2.2",
    "0.3.0",
    "0.3.1",
    "0.3.2",
    "0.4.0",
    "0.4.1",
    "0.4.2",
    "0.5.0-rc.1",
    "0.5.0",
    "0.5.1",
    "0.5.2",
    "0.6.0",
    "0.6.1",
    "0.7.0",
    "0.8.0",
    "0.8.1",
    "0.8.2",
    "0.9.0",
    "0.9.1",
    "0.9.2",
    "0.10.0",
    "1.0.0-rc.1",
    "1.0.0-rc.2",
    "1.0.0-rc.3",
    "1.0.0",
    "1.0.1",
    "1.0.2",
    "1.1.0",
    "1.1.1",
    "1.2.0",
    "1.2.1",
    "1.3.0",
    "1.3.1",
    "2.0.0",
    "2.1.0",
    "2.2.0",
    "2.2.1",
    "2.3.0",
    "2.4.0",
    "2.4.1",
    "2.4.2",
    "3.0.0",
    "3.0.1",
    "3.1.0",
    "3.2.0",
    "3.3.0",
    "3.3.1",
    "3.4.0",
    "3.5.0",
    "3.6.0",
    "3.7.0",
    "3.8.0",
    "3.9.0",
    "3.9.1",
    "3.9.2",
    "3.9.3",
    "3.10.0",
    "3.10.1",
    "4.0.0",
    "4.0.1",
    "4.1.0",
    "4.2.0",
    "4.2.1",
    "4.3.0",
    "4.4.0",
    "4.5.0",
    "4.5.1",
    "4.6.0",
    "4.6.1",
    "4.7.0",
    "4.8.0",
    "4.8.1",
    "4.8.2",
    "4.9.0",
    "4.10.0",
    "4.11.0",
    "4.11.1",
    "4.11.2",
    "4.12.0",
    "4.13.0",
    "4.13.1",
    "4.14.0",
    "4.14.1",
    "4.14.2",
    "4.15.0",
    "4.16.0",
    "4.16.1",
    "4.16.2",
    "4.16.3",
    "4.16.4",
    "4.16.5",
    "4.16.6",
    "4.17.0",
    "4.17.1",
    "4.17.2",
    "4.17.3",
    "4.17.4",
    "4.17.5",
    "4.17.9",
    "4.17.10"
  ],
  "dist-tags": {
    "latest": "4.17.10",
    "bug fix": "1.0.2"
  },
  "_rev": "1948-eebbdd91f36484d1",
  "_attachments": {},
  "_etag": "\"2ca003340e058b8bd0f2810a774eae5b\"",
  "version": "4.17.10",
  "description": "Lodash modular utilities.",
  "keywords": [
    "modules",
    "stdlib",
    "util"
  ],
  "homepage": "https://lodash.com/",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/lodash/lodash.git"
  },
  "icon": "https://lodash.com/icon.svg",
  "license": "MIT",
  "main": "lodash.js",
  "author": "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
  "contributors": [
    "John-David Dalton <john.david.dalton@gmail.com> (http://allyoucanleet.com/)",
    "Mathias Bynens <mathias@qiwi.be> (https://mathiasbynens.be/)"
  ],
  "scripts": {
    "test": "echo \"See https://travis-ci.org/lodash-archive/lodash-cli for testing details.\""
  },
  "bugs": {
    "url": "https://github.com/lodash/lodash/issues"
  },
  "_id": "lodash@4.17.10",
  "_npmVersion": "6.0.0-next.2",
  "_nodeVersion": "9.11.1",
  "_npmUser": "jdalton <john.david.dalton@gmail.com>",
  "dist": {
    "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==",
    "shasum": "1b7793cf7259ea38fb3661d4d38b3260af8ae4e7",
    "tarball": "http://ps20.pointsourcellc.com:4873/lodash/-/lodash-4.17.10.tgz",
    "fileCount": 1049,
    "unpackedSize": 1399800,
    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa33JqCRA9TVsSAnZWagAA0v4P/j+STtIL2K020wYEwPab\nWcDg2zwjWib+2mePvIwCylNI8YZs9vQXD9HvhWDD7/RH9bem/0sF45AgUk+w\na3bQGG1h5vFDHKftolS2fsa1HoT8ECEK2iVHQrS/DyCBcWYjfFUwErpd/NLx\nUpl9vW3Ba5clHUlq9rccOZ4Ld2gVQV8b2+p9V1IJeN9rkIOfRAg16FxAZjQZ\n9mj/XBR/Qw0XAEy31J63Rj+815CINYihHwpPdkaOTXDzouIn1/dP8jFp9oPY\nSGvwi4q6HBVbuuXmjcmMXIHRWz0drK3uex/3944yNzLlcu2Qn2rPqpQiD2rO\nYfIkwOd9TYfKfjvVGqEMzZHtLX408bm2kGtdyOLECuKAMSd5U9pOWfbVEeLN\nrydQQyGRC475Y15G58hSP0XbNM27dlEB+lfR6xtEcTLT75B/lxW2KxwxOff2\nLOTRfpd6Hx9d+5K80vAu1Ms8G69h2HPTDobJRmSPU+w/UTjeL9hrFy9x3hV8\n6xFgYOj8VZDiDpq0H1b0TH4GRGV0YvfVZ1V50Jzc3GZsKzSqk0i+UKDLuWVT\nYiTpQOPBlKysD3gGRjWMDd7jRMbf2b2B4Ajl5LhaB6mVjNnK8IMkTIegrwHP\nIOuE39Y1Vr1xBRlCBYcUdDrkPSCxlxzsToRPpo/1uWH1CI7HIBQsCJ2/h+n6\n6zBR\r\n=aCN9\r\n-----END PGP SIGNATURE-----\r\n"
  },
  "maintainers": [
    "jdalton <john.david.dalton@gmail.com>",
    "mathias <mathias@qiwi.be>"
  ],
  "directories": {},
  "_npmOperationalInternal": {
    "host": "s3://npm-registry-packages",
    "tmp": "tmp/lodash_4.17.10_1524593257507_0.03186110402277009"
  }
}

(Kat Marchán) #4

Ah ok.

This is an issue with your private registry. It’s missing the "time" property on the main packument and that’s what’s breaking things.

Moving this to be a support issue. Please talk to your private registry vendor/maintainer about this, and it should be resolved then.


(Danny Levenson) #5

@zkat,
One other thing to point out is that if I back level npm to version 5.6, this problem seems to go away.

Is that because of new features/function in 6.2?


(Kat Marchán) #6

It’s because the shiny new version of npm view is accessing that field directly. That’s also why --json will work for you, because that basically reverts to pretty much the old behavior.


(system) #7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.