mhulse / kludgy

Kludgy: A macOS Node.js module/app that generates a random Google Street View desktop wallpaper.
Apache License 2.0
4 stars 2 forks source link

No worky when installed globally #19

Closed mhulse closed 6 years ago

mhulse commented 6 years ago

It's because the bin.js does not know where to run npm start from.

Here's is a possible fix:

let cwd = path.dirname(fs.realpathSync(process.argv[1]));
exec(`cd "${cwd}" && npm start -- "${helpers.argv(0)}" "${helpers.argv(1)}"`);

Seems slightly hacky though. Need to figure out if this is the best way to call npm start from a bin script?

mhulse commented 6 years ago

https://stackoverflow.com/a/22492384

Use __filename over process.argv[1]?

mhulse commented 6 years ago

What about: $(nodenv which npm)?

See: https://github.com/istanbuljs/nyc/issues/230#issuecomment-209826191

mhulse commented 6 years ago

https://github.com/nodenv/nodenv/blob/master/README.md

Maybe just which npm?

mhulse commented 6 years ago

no which, just going to use __filename.