dominictarr / npmd

MIT License
450 stars 37 forks source link

TypeError: Cannot set property 'x256' of undefined #18

Open kanzure opened 11 years ago

kanzure commented 11 years ago

I just ran:

npmd --sync

And now that it's synced (and still running in the background), I tried:

npmd

and consistently get:

/usr/local/lib/node_modules/npmd/node_modules/npmd-link/node_modules/get-deps/index.js:6
    a[k] = b[k]
         ^
TypeError: Cannot set property 'x256' of undefined
    at merge (/usr/local/lib/node_modules/npmd/node_modules/npmd-link/node_modules/get-deps/index.js:6:10)
    at module.exports (/usr/local/lib/node_modules/npmd/node_modules/npmd-link/node_modules/get-deps/index.js:15:11)
    at /usr/local/lib/node_modules/npmd/node_modules/npmd-link/index.js:187:14
    at /usr/local/lib/node_modules/npmd/options.js:11:27
    at execCommands (/usr/local/lib/node_modules/npmd/index.js:74:31)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npmd/index.js:98:7)
    at EventEmitter.emit (events.js:98:17)
    at Socket.onConnect (/usr/local/lib/node_modules/npmd/node_modules/autonode/index.js:53:15)
    at Socket.g (events.js:175:14)
    at Socket.EventEmitter.emit (events.js:92:17)
kanzure commented 11 years ago

Oops, that wasn't the root problem. I was hanging out in stream-adventure/ when I was running that command. Here's a more specific complaint:

mkdir -p /tmp/whatever && cd /tmp/whatever
npmd

which gives me:

/usr/local/lib/node_modules/npmd/node_modules/npmd-link/node_modules/get-deps/node_modules/package/lib/package.js:54
      throw new Error('package.json can not be located');
            ^
Error: package.json can not be located
    at Function.package.discover (/usr/local/lib/node_modules/npmd/node_modules/npmd-link/node_modules/get-deps/node_modules/package/lib/package.js:54:13)
    at package (/usr/local/lib/node_modules/npmd/node_modules/npmd-link/node_modules/get-deps/node_modules/package/lib/package.js:23:24)
    at module.exports (/usr/local/lib/node_modules/npmd/node_modules/npmd-link/node_modules/get-deps/index.js:15:18)
    at /usr/local/lib/node_modules/npmd/node_modules/npmd-link/index.js:187:14
    at /usr/local/lib/node_modules/npmd/options.js:11:27
    at execCommands (/usr/local/lib/node_modules/npmd/index.js:74:31)
    at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npmd/index.js:98:7)
    at EventEmitter.emit (events.js:98:17)
    at Socket.onConnect (/usr/local/lib/node_modules/npmd/node_modules/autonode/index.js:53:15)
    at Socket.g (events.js:175:14)

I don't think this was a design choice.

dominictarr commented 11 years ago

yeah, this is a bug. should dump help info or something when you run with out args. mostly I've focused on installing.

the bug here was that some commands look for a local package.json, but I didn't have a sensible check if it's not there.

will fix