eanplatter / forked

:fork_and_knife: forks, forks everywhere.
MIT License
50 stars 4 forks source link

Cannot read property 'repo' of null #2

Closed agarzola closed 8 years ago

agarzola commented 8 years ago

I’m getting this error after installing, navigating to a project dependency (on an unrelated project), and using fork:

/bin/sh: json: command not found
/usr/local/lib/node_modules/forked/dist/index.js:35
var index = meta.repo.indexOf('.git');
                ^

TypeError: Cannot read property 'repo' of null
    at Object.<anonymous> (/usr/local/lib/node_modules/forked/dist/index.js:35:17)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:136:18)
    at node.js:963:3

I also noticed that line #33 seems to be missing something, which may be related. I haven’t used babel yet, though, so I might just be missing something here.

eanplatter commented 8 years ago

Looks like meta isn't being defined properly, what module were you trying to fork? I can probably reproduce it.

agarzola commented 8 years ago

slush

eanplatter commented 8 years ago

Thanks I'll check it out!

eanplatter commented 8 years ago

Hrmmm, it worked for me, but I did ship some bug fixes recently, what version of forked are you using?

EDIT: Screen shot:

screen shot 2016-04-05 at 8 27 24 pm
agarzola commented 8 years ago

0.0.11 it looks like.

agarzola commented 8 years ago

I just tried it on shelljs with the same result. Something is clearly wrong on my end. I’m on node 4.2.2, if that makes a difference.

eanplatter commented 8 years ago

So the way it works is forked is looking for a ./package.json file, I am able to reproduce your error by running $ fork in a random folder that doesn't contain a package.json file.

agarzola commented 8 years ago

screenshot 2016-04-05 21 32 46

agarzola commented 8 years ago

I wonder what that json: command not found is all about.

eanplatter commented 8 years ago

hrmmm I think the crux of the error is actually the /bin/sh: json: command not found.

Looks like it's not able to run the parsing command, which explains why meta is undefined.

eanplatter commented 8 years ago

I might be wrongfully assuming environment specific things, looking into it

agarzola commented 8 years ago

Right. Does it make sense that package.json defines dist/main.js instead of dist/index.js?

eanplatter commented 8 years ago

Oh that's borked too, ima fix that.

Could you try running this in your console and show me what it spits out? $ cat package.json | json repository.url

agarzola commented 8 years ago

bash: json: command not found Clearly I’m missing that.

eanplatter commented 8 years ago

Well, if you are then a lot of other people probably are.

agarzola commented 8 years ago

I got a PR for you in a sec.