fnm icon indicating copy to clipboard operation
fnm copied to clipboard

Windows install did not add PATH environment after installed node.

Open amnuaym opened this issue 9 months ago • 9 comments

I did fnm install 22 and need to manually add the path to an installation manually. C:\Users\username\appdata\Roaming\fnm\node-versions\v22.14.0\installation

amnuaym avatar Apr 08 '25 03:04 amnuaym

This solution works: https://stackoverflow.com/questions/78606679/unable-to-install-and-use-nodejs-using-fnm/78619685#78619685

alex-vovk-info avatar Apr 09 '25 20:04 alex-vovk-info

👋 @Schniz checking in on this one -- this is the install path we're recommending by default on nodejs.org for Windows users now, and folks are getting stuck due to this. Is this an issue with the Winget script, or do we need to include shell setup in the instructions we're showing (the README here doesn't point to manual shell setup for winget).

MattIPv4 avatar Apr 14 '25 18:04 MattIPv4

same issue on my windows... I am curious why path was not added to the system automatically. I hope this feature can be added to fnm in the future.

oliverance avatar Apr 23 '25 17:04 oliverance

I hope this feature can be added to fnm in the future too

ct-groups avatar Apr 24 '25 11:04 ct-groups

RainerZufall187 avatar May 03 '25 17:05 RainerZufall187

The docs in this tool and the Node.js download page can be improved.

The Node.js download page sets the expectation for Windows users that everything will work after you execute these commands:

# Download and install fnm:
winget install Schniz.fnm  

# Download and install Node.js:
fnm install 22

# Verify the Node.js version:
node -v # Should print "v22.15.0".

# Verify npm version:
npm -v # Should print "10.9.2".

This is not true.

You will get an error when you execute node —v because such a command is not found in the PATH variable.

fnm expects that you will also configure your shell by adding the execution of fnm env to the PowerShell profile file:

https://github.com/Schniz/fnm?tab=readme-ov-file#shell-setup

Invoke-Item $profile

And next insert:

fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression

However, this is not mentioned on the Node.js download page. Still, it is described in the second part of the fnm README in the Shell Setup sub-section of the Completions section, which people may not consider a mandatory step and will skip.

Also, many people do not expect to need to set up their shell and expect that environment variables will be set for them on fnm install 22 step. This is the first intuition when you see the Node download page.

Berehulia avatar May 10 '25 17:05 Berehulia

Still hard to understand and remember without googling, since most people just never seen those powershell commands Invoke-*.

For someone who don't really need to switch between Node.js versions, using winget is much easier to install Node.js on Windows:

Node.js (Latest Stable):

winget install -e --id=OpenJS.NodeJS

Node.js (LTS):

winget install -e --id=OpenJS.NodeJS.LTS

Automatically works on cmd.exe or powershell.exe.

louislam avatar May 16 '25 18:05 louislam

Though adding a startup script when starting PowerShell works, Cursor cannot detect those envs.

oxygenkun avatar May 23 '25 06:05 oxygenkun

winget install -e --id=OpenJS.NodeJS.LTS Automatically works on cmd.exe or powershell.exe.

This is incredible! Works for me. Really don't even know that this is possible

psoloviov avatar May 23 '25 11:05 psoloviov