You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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!
The text was updated successfully, but these errors were encountered:
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 becauseos.homedir()
always returns the Windows-defined home directory (%USERPROFILE%
, typicallyC:\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 importingnpm-conf
to behave wrongly.https://github.com/kevva/npm-conf/blob/master/lib/defaults.js#L21
I'd suggest that
npm-conf
check ifprocess.env.HOME
is defined, and only set it toos.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!
The text was updated successfully, but these errors were encountered: