npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

HOME environment variable changes under npm on Windows

Hi all,
I’ve noticed a quirk when running npm scripts via Git Bash on Windows 10. Namely, the value of my HOME variable changes for commands called via npm, as opposed to direct from the shell:

$ env |grep ^HOME=

$ npm run env |grep ^HOME=

This is creating some headaches, because in I’m running scripts which depend on Git and ssh configuration, which are expected to live under $HOME. Does anyone know why this occurs, and/or how to change it?

For now, I’m working around it by maintaining the configs under both HOME paths, but feel like it would be cleaner to use the same path for either context.