Confusing error on bad semver #827

Closed
deanlandolt opened this Issue Apr 20, 2011 · 5 comments

2 participants

@deanlandolt

When trying to npm link a package with a seemingly valid package.json:

npm ERR! TypeError: Cannot read property '_id' of undefined
npm ERR! at cb (/usr/local/lib/node_modules/npm/lib/link.js:103:33)
npm ERR! at /usr/local/lib/node_modules/npm/lib/link.js:105:20
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/read-json.js:44:24
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/read-json.js:218:20
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/read-json.js:91:32
npm ERR! at P (/usr/local/lib/node_modules/npm/lib/utils/read-json.js:68:40)
npm ERR! at cb (/usr/local/lib/node_modules/npm/lib/utils/graceful-fs.js:31:9)
npm ERR! at [object Object]. (fs.js:107:5)
npm ERR! at [object Object].emit (events.js:61:17)
npm ERR! at afterRead (fs.js:878:12)
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com
npm ERR!
npm ERR! System Darwin 10.6.0
npm ERR! command "node" "/usr/local/bin/npm" "link"
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/dean/dev/templify/npm-debug.log
npm not ok

Turned out the version key was at "0.9" which is an invalid semver. This is just a nice to have enhancement request, but a better error message here would have saved me fifteen minutes or so.

@isaacs
npm member

What version of npm, and what's in the package.json?

@deanlandolt

whoops, sorry...1.0 rc9 and the package.json is here: https://github.com/dmachi/templify/blob/master/package.json

@deanlandolt deanlandolt reopened this Apr 20, 2011
@isaacs
npm member

How are you installing it? This is the error I get:

$ npm install https://github.com/dmachi/templify/tarball/master
npm ERR! couldn't unpack /var/folders/R3/R3EA-a2UE2OcM6kNMZeg0E++Lz2/-Tmp-/npm-1303333965348/1303333965348-0.4282599836587906/tmp.tgz to /var/folders/R3/R3EA-a2UE2OcM6kNMZeg0E++Lz2/-Tmp-/npm-1303333965348/1303333965348-0.4282599836587906/contents
npm ERR! Error: Invalid version: 0.9
npm ERR! Must be X.Y.Z, with an optional trailing tag.
npm ERR! See the section on 'version' in `npm help json`
npm ERR!     at /Users/isaacs/dev-src/js/npm/lib/utils/read-json.js:215:13
npm ERR!     at /Users/isaacs/dev-src/js/npm/lib/utils/read-json.js:91:32
npm ERR!     at P (/Users/isaacs/dev-src/js/npm/lib/utils/read-json.js:68:40)
npm ERR!     at cb (/Users/isaacs/dev-src/js/npm/lib/utils/graceful-fs.js:31:9)
npm ERR!     at [object Object].<anonymous> (fs.js:107:5)
npm ERR!     at [object Object].emit (events.js:61:17)
npm ERR!     at afterRead (fs.js:970:12)
npm ERR!     at wrapper (fs.js:245:17)
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Darwin 10.7.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "https://github.com/dmachi/templify/tarball/master"
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/isaacs/dev-src/js/npm/npm-debug.log
npm not ok

So, either it's already fixed in HEAD, or you're doing something different :)

@isaacs isaacs closed this Apr 20, 2011
@deanlandolt

oh? weird...i was just cloning the repo and trying to npm link it...i'll try head in a bit

@isaacs
npm member

Aha. Yes, npm link does have a confusing error. Fixing that now, thanks :)

@isaacs isaacs reopened this Apr 20, 2011
@isaacs isaacs closed this in a9fcb63 Apr 20, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment