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

Windows Installer didn't add Node PATH #4356

Closed
benirose opened this issue Dec 3, 2012 · 33 comments
Closed

Windows Installer didn't add Node PATH #4356

benirose opened this issue Dec 3, 2012 · 33 comments

Comments

@benirose
Copy link

benirose commented Dec 3, 2012

I just installed Node using the .msi for Windows 7 64-bit. It seemed to add npm to my PATH but not node. I was able to add it easily, but didn't see this detail in the instructions. A new developer may not know this is something they have to do if the install fails to do it. Adding a note to the installation instructions may be helpful.

@isaacs
Copy link

isaacs commented Dec 3, 2012

It should add them both. What was the PATH value after running the installer

/cc @piscisaureus @sblom

@benirose
Copy link
Author

benirose commented Dec 3, 2012

I had just "C:\Users\brosenbach\AppData\Roaming\npm" as my PATH. I had to add ";C:\Program Files\nodejs" myself. Not sure why that was.

@paulxtiseo
Copy link

Same here. Just installed using MSI installer, 64bit version. Path was incorrectly set. Even now, when I fixed it manually by adding "C:\Program Files\nodejs" (to user environment and system environment) and removing the Appdata one that points to an empty folder, I can only run it from any command-line if cmd.exe is run as Administrator. As a user, I can only run it from inside that folder.

@MllePandaRoux
Copy link

Same issue here! :)

@Loque-
Copy link

Loque- commented Sep 2, 2013

This just happened to me with the installer: v0.10.17

(added roaming path and not path to application, in my case R:\Applications\nodejs)

@jgillich
Copy link

jgillich commented Jan 3, 2014

Just had the same problem as @benirose on a fresh Windows 8.1 Pro installation.

@TahsinAbrar
Copy link

I'm also facing the same problem. When I wrote echo $PATH in node.js terminal, It didn't show anything. I need to set the PATH to "C:\Program Files\nodejs". So, what should I do now?

@marceloco
Copy link

I just had the same problem on a Surface Pro running Windows 8.1 Pro (64 bit).

@rbellio
Copy link

rbellio commented Mar 9, 2014

I had the same issue, but I noticed if I opened up my environment variables, node was in my path already. Closing environment variables, re-opening my command windows and node is now on my path and available.

@rjt
Copy link

rjt commented Mar 9, 2014

Yep, windows is like that, having to close out of the windows cmd line and
reopen is one of the reasons we like bash.
On Mar 9, 2014 7:30 AM, "rbellio" [email protected] wrote:

I had the same issue, but I noticed if I opened up my environment
variables, node was in my path already. Closing environment variables,
re-opening my command windows and node is now on my path and available.

Reply to this email directly or view it on GitHubhttps://github.com//issues/4356#issuecomment-37125852
.

@rbellio
Copy link

rbellio commented Mar 9, 2014

You may misunderstand me. It wasn't the opening and closing of windows cmd line that fixed the issue for me. It was opening Environment Variables and closing it that made it work. It's almost as if Environment Variables did not recognize the change.

@rjt
Copy link

rjt commented Mar 9, 2014

System wide variable changes are usually not fully recognized on windows
till after a reboot. ReOpening the cmd line has been required for years.
Power shell or Win8 may be better.
On Mar 9, 2014 9:02 AM, "rbellio" [email protected] wrote:

You may misunderstand me. It wasn't the opening and closing of windows cmd
line that fixed the issue for me. It was opening Environment Variables and
closing it that made it work. It's almost as if Environment Variables did
not recognize the change.

Reply to this email directly or view it on GitHubhttps://github.com//issues/4356#issuecomment-37127559
.

@dougwilson
Copy link
Member

Yes, needing a reboot is something required, but other times simply opening a new Command Prompt windows is sufficient. Perhaps the installer should simply recommend a reboot after install to clear up the confusion when users try to instantly start using node.js from the command line?

@dougwilson
Copy link
Member

Actually, I take that back. The installer should be able to get the new PATH picked up by broadcasting a WM_SETTINGCHANGE message to all the open windows. More information at https://stackoverflow.com/questions/3636055/how-to-modify-the-path-variable-definitely-through-the-command-line-in-windows

It seems from these reports that this isn't being done, so if the installer did this, it should fix the issue.

@dougwilson
Copy link
Member

For those so inclined to make a PR to this, it looks like someone has posted instructions for how to accomplish this in WiX: http://www.kajabity.com/2013/09/an-update-to-the-apache-maven-installers-broadcasting-wm_settingchange-to-update-environment-variables/

@David-dp-
Copy link

The fix isn't yet in the installer, at least from my experience using it today on Win8.1 Pro 64-bit. Opening and closing "Environment Variables" only worked if I closed with the OK button; trying Cancel didn't. FYI.

@louy2
Copy link

louy2 commented Jun 22, 2014

I did not install Node into Program Files, but interestingly the PATH added by the installer had an extra / at the end which prevented the positive result.

@qfox
Copy link

qfox commented Jul 4, 2014

👍

@rmarskell
Copy link

Same thing happened to me today. The fix mentioned by @rbellio made the path updates be recognized without a reboot.

@sjdirect
Copy link

Same here but a restart fixed the issue. Path was recognized after that.

@sylvia43
Copy link

Restart fixed the issue, Windows 8.1.

@rahul-desai3
Copy link

I ran the command prompt as administrator and it worked.
Windows 8.1

@David-dp-
Copy link

It's been awhile since I've done this. Are there explicit instructions
about not double-clicking but using admin console instead?
On Nov 5, 2014 4:10 AM, "Rahul Desai" [email protected] wrote:

I ran the command prompt as administrator and it worked.
Windows 8.1


Reply to this email directly or view it on GitHub
#4356 (comment).

@Frankenmint
Copy link

I'm having the reverse issue where global modules do not work for me, not sure why

@misterdjules
Copy link

This has been fixed by io.js in nodejs/node#603. I suggest that we integrate this fix in v0.12. Removing the maybe-close label.

orangemocha pushed a commit that referenced this issue May 11, 2015
This is needed so that we can backport
668bde8 from io.js with
a clean merge.

PR-URL: #25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: #4356
orangemocha pushed a commit that referenced this issue May 11, 2015
Backport 668bde8 from io.js.
Original commit message follows:

In theory the msi should broadcast a 'WM_SETTINGCHANGE' message to all
windows after modifying the PATH environment variable. This ensures that
the new PATH is visible to other processes without restarting windows
(although it's still necessary to close and reopen active console
windows).

Unfortunately, the broadcast doesn't always happen, for unknown reasons.
That's why this patch adds a custom action that unconditionally
broadcasts a WM_SETTINGCHANGE message.

Bug: nodejs/node#603
PR: nodejs/node#613
Reviewed-by: Bert Belder <[email protected]>
(cherry picked from commit 668bde8)

--Node.js commmit metadata--
PR-URL: #25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: #4356
misterdjules pushed a commit to misterdjules/node that referenced this issue May 11, 2015
This is needed so that we can backport
668bde8 from io.js with
a clean merge.

PR-URL: nodejs#25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: nodejs#4356
misterdjules pushed a commit to misterdjules/node that referenced this issue May 11, 2015
Backport 668bde8 from io.js.
Original commit message follows:

In theory the msi should broadcast a 'WM_SETTINGCHANGE' message to all
windows after modifying the PATH environment variable. This ensures that
the new PATH is visible to other processes without restarting windows
(although it's still necessary to close and reopen active console
windows).

Unfortunately, the broadcast doesn't always happen, for unknown reasons.
That's why this patch adds a custom action that unconditionally
broadcasts a WM_SETTINGCHANGE message.

Bug: nodejs/node#603
PR: nodejs/node#613
Reviewed-by: Bert Belder <[email protected]>
(cherry picked from commit 668bde8)

--Node.js commmit metadata--
PR-URL: nodejs#25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: nodejs#4356
misterdjules pushed a commit to misterdjules/node that referenced this issue May 13, 2015
This is needed so that we can backport
668bde8 from io.js with
a clean merge.

PR-URL: nodejs#25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: nodejs#4356
misterdjules pushed a commit to misterdjules/node that referenced this issue May 13, 2015
Backport 668bde8 from io.js.
Original commit message follows:

In theory the msi should broadcast a 'WM_SETTINGCHANGE' message to all
windows after modifying the PATH environment variable. This ensures that
the new PATH is visible to other processes without restarting windows
(although it's still necessary to close and reopen active console
windows).

Unfortunately, the broadcast doesn't always happen, for unknown reasons.
That's why this patch adds a custom action that unconditionally
broadcasts a WM_SETTINGCHANGE message.

Bug: nodejs/node#603
PR: nodejs/node#613
Reviewed-by: Bert Belder <[email protected]>
(cherry picked from commit 668bde8)

--Node.js commmit metadata--
PR-URL: nodejs#25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: nodejs#4356
@misterdjules misterdjules modified the milestones: 0.12.3, 0.12.4 May 14, 2015
@misterdjules misterdjules modified the milestones: 0.12.4, 0.12.5 May 25, 2015
@misterdjules misterdjules modified the milestones: 0.12.5, 0.12.6 Jun 22, 2015
@orangemocha
Copy link
Contributor

Fixed with f50c37d and shipped in v0.12.5.

@misterdjules misterdjules modified the milestones: 0.12.5, 0.12.6 Jun 24, 2015
@misterdjules
Copy link

This issue was moved to milestone 0.12.6 by mistake because it hadn't been closed after the fix landed and shipped with node v0.12.5. Moving it back to the 0.12.5 milestone to avoid confusion.

@ArtemKolodko
Copy link

@uniring it works from console, thank you

jBarz pushed a commit to ibmruntimes/node that referenced this issue Nov 4, 2016
This is needed so that we can backport
668bde8 from io.js with
a clean merge.

PR-URL: nodejs#25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: nodejs#4356
jBarz pushed a commit to ibmruntimes/node that referenced this issue Nov 4, 2016
Backport 668bde8 from io.js.
Original commit message follows:

In theory the msi should broadcast a 'WM_SETTINGCHANGE' message to all
windows after modifying the PATH environment variable. This ensures that
the new PATH is visible to other processes without restarting windows
(although it's still necessary to close and reopen active console
windows).

Unfortunately, the broadcast doesn't always happen, for unknown reasons.
That's why this patch adds a custom action that unconditionally
broadcasts a WM_SETTINGCHANGE message.

Bug: nodejs/node#603
PR: nodejs/node#613
Reviewed-by: Bert Belder <[email protected]>
(cherry picked from commit 668bde8)

--Node.js commmit metadata--
PR-URL: nodejs#25100
Reviewed-By: Julien Gilli <[email protected]>
Fixes: nodejs#4356
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests