jonschlinkert / global-prefix

Get the npm global path prefix. Same code used internally by npm.
MIT License
28 stars 12 forks source link

Check $HOME is actually set before using it in paths #10

Closed avengerpenguin closed 7 years ago

avengerpenguin commented 8 years ago

Just did the simple thing.

pmmaga commented 8 years ago

I have come across this exact issue and it took me a while to solve. I ended up having to export the HOME variable when calling gulp with an user without environment.

This PR would be great to avoid this kind of issues.

jonschlinkert commented 8 years ago

sorry I missed this PR somehow.

Does only osenv return undefined when $HOME is not set, or does the following also return undefined?

var os = require('os');
console.log(os.homedir());
pmmaga commented 8 years ago

The undefined will come from os.homedir() as well.