21

I try to run nodejs on a brand new installation of Windows 7. This is what I've done:

  1. Install node using the windows installer

  2. Make sure the files were extracted to C:\Program Files (x86)\nodejs\

  3. Make sure that my Path enviorment variable contains C:\Program Files (x86)\nodejs\

  4. open up a command prompt and run node -v

This gives me the 'node is not a recognized ...' - message.

What am I missing here?


Update running echo %path% gives me a directory listing that doesn't include C:\Program Files (x86)\nodejs\, even though looking at the "environment variables" tab in the system properties displays it under path. Thats odd.

AdrieanKhisbe
  • 3,532
  • 7
  • 31
  • 45
Soroush Hakami
  • 4,666
  • 13
  • 61
  • 96
  • 1
    Do you really think your laptop model matters? :p – ThiefMaster Apr 12 '12 at 18:32
  • What's the full path to the binary? Is it in ...\nodejs\, or ...\nodejs\bin\, for example? – jimw Apr 12 '12 at 18:32
  • 1
    @ThiefMaster: Hehe, no, not really. But when I have this kind of error that I really dont have a clue of the reason, I just try to include as much data as possible. The laptopmodel was probably just unnessesary though. – Soroush Hakami Apr 12 '12 at 18:35
  • @jimw: I dont even have a nodejs\bin. In the nodejs dir, I have just a node application file. – Soroush Hakami Apr 12 '12 at 18:36
  • 1
    Right, not that then. What does 'echo %PATH%' give you in your command shell? Sorry for the obvious questions :-) – jimw Apr 12 '12 at 18:40
  • @jimw Updated the question right before I saw this comment. Echoing path doesnt list the directory, still wondering how it could be visible under system properties then. – Soroush Hakami Apr 12 '12 at 18:42
  • Aha! So for some reason you command shell isn't getting the environment variable from the GUI. A workaround would be to 'set PATH ...' in your command shell, but that doesn't solve the actual problem... – jimw Apr 12 '12 at 18:46
  • Solved it. Thanks for the help though @jimw :) – Soroush Hakami Apr 12 '12 at 18:49
  • Ah good, glad to see you worked it out. Happy noding! – jimw Apr 12 '12 at 19:11

2 Answers2

31

UPDATE: a quicker solution is per Timos comment: "Restarting explorer.exe is enough, you can stop it in task manager and start it again"

This was solved by restarting the computer.

Apparently, using the Node installer sets the path so that it is visible under system properties, but not in the command prompt (running echo %path%) until you restart your computer. Not sure if this is a problem with Windows, or the Node Installer.

Soroush Hakami
  • 4,666
  • 13
  • 61
  • 96
  • Changes to the System Properties will not affect any _open_ command prompts. You can simply re-open a new command prompt for the new PATH to take effect. Or manually add it in your %PATH% for existing command prompt. – Hanxue Jan 06 '13 at 21:52
  • 1
    I'm not 100% sure since this was a while ago, but I believe i did re-open the command prompt. – Soroush Hakami Jan 07 '13 at 09:52
  • 3
    I can confirm the behaviour Soroush found. I didn't have any command prompts open, but the path wasn't picking up node after an install. – pnewhook Jan 09 '13 at 17:25
  • 24
    Restarting explorer.exe is enough, you can stop it in task manager and start it again – Timo Huovinen Jan 13 '13 at 20:49
  • Another confirmation. I thought closing and reopening the command prompt window would enable it, but it didn't. Restarting explorer did it though without a restart. – rball Sep 12 '14 at 22:20
14

Timo's statement is accurate. For completeness...

To start explore.exe again, Ctrl+Shift+Esc to open Task Manager

Then do File > New Task (Run)> type: explorer.exe > Enter > Voila!

AdrieanKhisbe
  • 3,532
  • 7
  • 31
  • 45
sesamechicken
  • 1,495
  • 11
  • 18
  • I guess as a developer, I already knew this? He did say restart explorer so I'm not sure how it is inaccurate. – rball Sep 12 '14 at 22:21
  • 6
    I said it was accurate - I was simply helping by providing the steps to accomplish it. I would've added it in a comment, but don't have the required rep to do so. – sesamechicken Sep 14 '14 at 14:35
  • 1
    To extend @sesamechicken and @Timo 's correct comments to the CLI; this can be done via a single line in `cmd`. `taskkill /f /im explorer.exe && explorer.exe`. This will kill the explorer.exe process and restart it. – S3DEV Jan 12 '18 at 11:15
  • 1
    Can you believe this issue is still happening? Restarting from the task manager using the menu option in Windows 10 doesn't work, at least for me. You must start explorer.exe again. – ATL_DEV Jan 21 '20 at 17:14
  • @S3DEV This worked for me but only after the desired new `PATH` was updated in same `cmd`. – jifb May 26 '21 at 13:55