coreybutler / nvm-windows

A node.js version management utility for Windows. Ironically written in Go.
MIT License
37.28k stars 3.32k forks source link

[Issue]: Windows Firewall Issue with nvm #1134

Closed Ajitweb closed 5 months ago

Ajitweb commented 5 months ago

What happened?

To allow incoming LAN connection to my node instance, I created an inbound rule to allow access to C:\Program Files\nodejs\node.exe. This is working fine. Now for nvm, I uninstalled the normal installation of node and installed it through nvm. But access from LAN is now denied. I even gave access to the actual node.exe location where nvm has installed the node. But no joy. So as of now, I have uninstalled nvm and installed node the regular way. Any idea - as to why windows firewall is not allowing incoming connections to the symlinked locations of node?

What did you expect to happen?

expected windows firewall rules to behave like a normal node installation

Version

1.1.11 or newer (Default)

Which version of Windows?

Windows 10 (Default)

Which locale?

English (Default)

Which shell are you running NVM4W in?

Command Prompt

User Permissions?

Administrative Privileges, Elevated

Is Developer Mode enabled?

No (Default)

Relevant log/console output

.

Debug Output

.

Anything else?

No response

coreybutler commented 5 months ago

Did you uninstall the original version of Node before installing NVM for Windows? If you didn't, and if C:\Program Files\nodejs was still referenced by the original installation, then the symlink creation would be blocked by the original installation. This means your firewall would only apply to the old node.exe, not the one managed by NVM4W.

To be clear, you have to specify the symlink location for the node.exe, not the physical path. Otherwise Windows Firewall will ignore the rule.

To test your environment, I would recommend opening a port on the firewall, then running your app with the NVM4W version of node on that port. In other words, don't restrict the firewall the node.exe file. If this works, then it is likely a path issue (as described above).

Ajitweb commented 5 months ago

Thank you for replying @coreybutler

Yes, I had uninstalled the original nodejs and even made sure that the nodejs directory is removed from the Program Files directory on the server PC. After nvm installation, all commands of nvm/node is working as expected - except for the firewall issue.

I experimented on another machine. Here , if I allow C:\Users\\AppData\Roaming\nvm\\node.exe in windows firewall - then I am able to acccess node from another PCs. Allowing, C:\Program Files\nodejs\node.exe did not.

Anyway, this means nvm is working with Windows Firewall !

Now I have to find out why the same outcome isn't occurring on my server.

Thanks.

coreybutler commented 5 months ago

@Ajitweb I'm glad you found clarification.

FWIW, C:\Program Files is a protected directory on Windows. It's not uncommon for Windows to require different privileges to make changes there. So, it could be a user permission issue instead of a firewall permission issue. The Wiki/common issues have a lot of notes about this. If you find yourself without a solution, trying setting the symlink to a different directory, like C:\nodejs. The big difference is that isn't a protected directory, so you can at least eliminate the OS restriction variable.