Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If HOME environment variable is set on Windows, it is overwritten #13

Open
itowlson opened this issue Jul 12, 2018 · 1 comment
Open

Comments

@itowlson
Copy link

If the user sets the HOME environment variable on Windows, importing npm-conf causes the environment variable to be changed to the user profile directory. This occurs because os.homedir() always returns the Windows-defined home directory (%USERPROFILE%, typically C:\Users\username); it does not consider the HOME environment variable (which is reasonable, as HOME is not significant to the Windows OS). But HOME is significant to many cross-platform applications, and modifying it can cause processes that are invoked after importing npm-conf to behave wrongly.

https://github.com/kevva/npm-conf/blob/master/lib/defaults.js#L21

I'd suggest that npm-conf check if process.env.HOME is defined, and only set it to os.homedir() if it is not defined. This would respect the user override if there is one, while ensuring that HOME is sanely defined if the user didn't set it explicitly.

I can send a PR for this if you'd like!

@nagilson
Copy link

cc @kevva This has caused https://github.com/Azure/get-proxy-settings to break git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants