Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Installer does not notify other apps after updating PATH #2407

Closed
joewhite opened this issue Dec 23, 2011 · 5 comments
Closed

Installer does not notify other apps after updating PATH #2407

joewhite opened this issue Dec 23, 2011 · 5 comments
Labels

Comments

@joewhite
Copy link

I installed node-v0.6.6.msi on a Windows machine that had never had node.js installed before. The installer ran, and when it was done, it told me to open a command prompt and type node. I did, and the command prompt told me "'node' is not recognized as an internal or external command, operable program or batch file."

When I looked in Control Panel > System > Advanced > Environment Variables, the PATH had been updated correctly. The installer apparently just didn't notify other running processes (specifically, Explorer) that they needed to reload their environment blocks. Since you use Windows Explorer (via the Start menu) to open the new command prompt, that command prompt inherits Explorer's environment block, and since Explorer's environment block was stale and didn't have the new PATH, I couldn't open a command prompt and run node.

I tried uninstalling node and then reinstalling, and the problem persisted, which seems to rule out any kind of sporadic problem -- it looks like the installer simply isn't sending the necessary change notifications.

This would have fixed itself if I had rebooted, but that's a poor solution. I fixed it manually by making a trivial edit to the PATH environment variable (still in the Environment Variables dialog) and clicking OK, which did notify running processes of the change, so Explorer reloaded its environment block, and then everything was fine. But the installer should be sending the proper notifications automatically so everything works.

I'm not sure what you use to build your installer, but here's some info on the notification that needs to be sent: http://support.microsoft.com/kb/104011

@ry
Copy link

ry commented Dec 23, 2011

@piscisaureus @igorzi @tjanczuk - any of you know how to do this with WiX?

@igorzi
Copy link

igorzi commented Dec 23, 2011

Windows installer already does this (broadcasting WM_SETTINGCHANGE message). See http://msdn.microsoft.com/en-us/library/windows/desktop/aa372883(v=vs.85).aspx.

Is it possible that you have a pending reboot on your system?

Environment variables do not change for the installation in progress when the WriteEnvironmentStrings action or RemoveEnvironmentStrings action are run. On Windows 2000, Windows Server 2003, Windows XP, and Windows Vista this information is stored in the registry and a WM_SETTINGCHANGE message is sent to notify the system of the changes when the installation completes. Another process can receive notification of the changes by handling these messages. No message is sent if a restart of the system is pending.

@chowey
Copy link

chowey commented Dec 24, 2011

Is it possible you had command prompt open before you started the node install? Command prompt only uses the snapshot of environment variables from when it was opened. If I manually modify my PATH variable, I need to open a new instance of command prompt for this change to take place.

@joewhite
Copy link
Author

Is it possible you had command prompt open before you started the node install?

Good thought, but no, I opened a new command prompt after the install.

Is it possible that you have a pending reboot on your system?

Not that I was aware of, but I guess it's possible. That's good to know, about it not broadcasting when there's a pending reboot. I won't be at that computer again until next Tuesday, but then I'll try uninstalling, rebooting, and then install and see if it works.

@igorzi
Copy link

igorzi commented Dec 24, 2011

Ok, closing the issue. Please reopen if you can reproduce after the reboot.

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

No branches or pull requests

4 participants