yeoman-app icon indicating copy to clipboard operation
yeoman-app copied to clipboard

Generators path not found causing no installed generators message.

Open mfunkie opened this issue 10 years ago • 10 comments

When running the Yeoman app, I noticed that in this block of code

https://github.com/yeoman/yeoman-app/blob/master/src/browser/yo/environment.js#L18

The path was not successfully split.

I started with the full path before: /usr/local/lib/node_modules/npm/bin/node-gyp-bin /Users/mfunk/Documents/yeoman-app/node_modules/.bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin

And the array of paths after is ['/usr/local/lib/node_modules/npm/bin/node-gyp-bin /Users/mfunk/Documents/yeoman-app/node_modules/.bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin']

If the paths were successfully split, it would have found my generators properly.

mfunkie avatar Jul 26 '15 14:07 mfunkie

Before fix-path is run, my path properly has : between the paths, after require('fix-path')(), my path no longer has : between the paths, but the delimiter is still considered to be :. Commenting out the fix-path line fixes the issue.

mfunkie avatar Jul 26 '15 14:07 mfunkie

@sindresorhus Any input on what is going on here?

Also, I feel like if we need "fix-path", then we should probably implement this directly in yeoman-environment so it support multiple type of environment.

SBoudrias avatar Jul 26 '15 21:07 SBoudrias

we should probably implement this directly in yeoman-environment so it support multiple type of environment.

Sounds sensible. Should I prepare a PR for it?

stefanbuck avatar Jul 26 '15 22:07 stefanbuck

we should probably implement this directly in yeoman-environment so it support multiple type of environment.

No, it's for OS X GUI apps. There's absolutely no reason for it to be in yeoman-environment.

sindresorhus avatar Jul 26 '15 22:07 sindresorhus

@mfunkie Weird. Works fine for me. What OS are you on? What do you get when running /bin/sh -i -c 'echo $PATH'? And when running node -e "console.log(require('child_process').execFileSync(process.env.SHELL || '/bin/sh', ['-c', 'echo $PATH']).toString().trim());"?

sindresorhus avatar Jul 26 '15 22:07 sindresorhus

But then we should at least provide a better way to pass a specific $PATH to yeoman-enviroment. Overriding getNpmPaths() is not the perfect solution.

stefanbuck avatar Jul 26 '15 23:07 stefanbuck

@stefanbuck No. The fix-path module fixes a limitation of OS X GUI apps not inheriting the $PATH of your shell. yeoman-generator shouldn't require any knowledge of that limitation.

sindresorhus avatar Jul 26 '15 23:07 sindresorhus

@mfunkie any news on your side regarding this issue? Did you tried what @sindresorhus suggested?

stefanbuck avatar Mar 28 '16 16:03 stefanbuck

Oh wow, I haven't thought about it in months. I could take another look in the next couple of days if that would help.

mfunkie avatar Mar 28 '16 16:03 mfunkie

That would be super helpful :+1: Thank you

stefanbuck avatar Mar 28 '16 16:03 stefanbuck