Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not put node on path in Windows PowerShell? #1379

Open
IanVS opened this issue Feb 7, 2025 · 10 comments
Open

Does not put node on path in Windows PowerShell? #1379

IanVS opened this issue Feb 7, 2025 · 10 comments

Comments

@IanVS
Copy link

IanVS commented Feb 7, 2025

I've followed the instructions on the node.js installation page for windows, but node is not available.

PS C:\Windows\system32> fnm install 22
Installing ←[36mNode v22.13.1←[0m (x64)
←[1;33mwarning:←[0m Version already installed at "C:\\Users\\ianvs\\AppData\\Roaming\\fnm\\node-versions\\v22.13.1"
PS C:\Windows\system32> node -v
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ node -v
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Am I missing something?

(I am using Windows 11 in Parallels from my mac, in case that matters)

And yes, I closed and re-opened the shell several times, and also tried running as administrator.

@futurist
Copy link

+1 for this issue

@devKarin
Copy link

+1 for this issue

On Windows 11,with Windows PowerShell 5.1, on Windows 11 with PowerShell 7.5.0.

@Evansch0
Copy link

+1

@IanVS
Copy link
Author

IanVS commented Feb 11, 2025

Y'all, just add thumbs to the original issue above.

@thnhan1
Copy link

thnhan1 commented Feb 12, 2025

As a good developer you should using stackoverflow > github issue.

@Schniz
Copy link
Owner

Schniz commented Feb 24, 2025

Well, we have e2e tests that ensure that PowerShell works reliably, so let's try to debug what's wrong in the setup. Setting up is unfortunately not that easy as I would want it to.

can you share the PATH env var? I don't remember the steps to do it on PowerShell but maybe you'll be able to translate what I want to do from Bash to PowerShell:

$ echo $PATH
# will show us whether you have FNM in the PATH env var

$ env | grep FNM_
will print out the fnm configuration coming from `fnm env`

$ ls $FNM_MULTISHELL_PATH
# here you will see the currently used Node.js

@IanVS
Copy link
Author

IanVS commented Feb 24, 2025

@Schniz thanks, is this useful?

PS C:\Windows\system32> fnm install 22
Installing ←[36mNode v22.14.0←[0m (x64)
00:00:05 ████████████████████████████████████████████████████████████████████████████████████████████████ 33.29 MiB/33.29 MiB (6.02 MiB/s, 0s)
PS C:\Windows\system32> fnm env
$env:PATH = "C:\Users\ianvs\AppData\Local\fnm_multishells\536_1740402936471;C:\Program Files\Parallels\Parallels Tools\Applications;C:\Python313\Scripts\;C:\Python313\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Go\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\ianvs\AppData\Local\Microsoft\WindowsApps;C:\Users\ianvs\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ianvs\AppData\Local\GitHubDesktop\bin;C:\Users\ianvs\go\bin;C:\Users\ianvs\AppData\Local\Microsoft\WinGet\Links;C:\Users\ianvs\AppData\Local\Microsoft\WinGet\Packages\Schniz.fnm_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\ianvs\AppData\Roaming\npm"
$env:FNM_MULTISHELL_PATH = "C:\Users\ianvs\AppData\Local\fnm_multishells\536_1740402936471"
$env:FNM_VERSION_FILE_STRATEGY = "local"
$env:FNM_DIR = "C:\Users\ianvs\AppData\Roaming\fnm"
$env:FNM_LOGLEVEL = "info"
$env:FNM_NODE_DIST_MIRROR = "https://nodejs.org/dist"
$env:FNM_COREPACK_ENABLED = "false"
$env:FNM_RESOLVE_ENGINES = "true"
$env:FNM_ARCH = "x64"
PS C:\Windows\system32> ls C:\Users\ianvs\AppData\Local\fnm_multishells\536_1740402936471


    Directory: C:\Users\ianvs\AppData\Local\fnm_multishells\536_1740402936471


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2/24/2025   8:15 AM                node_modules
-a----         2/24/2025   8:15 AM          55725 CHANGELOG.md
-a----         2/24/2025   8:15 AM            334 corepack
-a----         2/24/2025   8:15 AM            218 corepack.cmd
-a----         2/24/2025   8:15 AM           3094 install_tools.bat
-a----         2/24/2025   8:15 AM         140396 LICENSE
-a----         2/24/2025   8:15 AM       83344536 node.exe
-a----         2/24/2025   8:15 AM            702 nodevars.bat
-a----         2/24/2025   8:15 AM           2073 npm
-a----         2/24/2025   8:15 AM            538 npm.cmd
-a----         2/24/2025   8:15 AM            795 npm.ps1
-a----         2/24/2025   8:15 AM           2073 npx
-a----         2/24/2025   8:15 AM            538 npx.cmd
-a----         2/24/2025   8:15 AM            795 npx.ps1
-a----         2/24/2025   8:15 AM          40660 README.md


PS C:\Windows\system32> node -v
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ node -v
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (node:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

One thing I notice, is that when I log out all of the env vars using just $env, then the FNM_ vars are not shown. And this is the equivalent of grepping for them, as far as I can tell (I'm not a Windows developer either):

PS C:\Windows\system32> Get-ChildItem Env: | Where-Object { $_.Name -Contains 'FNM_' }
PS C:\Windows\system32>

And when I run $env:PATH I see something slightly different from above as well:

PS C:\Windows\system32> $env:PATH
C:\Program Files\Parallels\Parallels Tools\Applications;C:\Python313\Scripts\;C:\Python313\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Go\bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\ianvs\AppData\Local\Microsoft\WindowsApps;C:\Users\ianvs\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\ianvs\AppData\Local\GitHubDesktop\bin;C:\Users\ianvs\go\bin;C:\Users\ianvs\AppData\Local\Microsoft\WinGet\Links;C:\Users\ianvs\AppData\Local\Microsoft\WinGet\Packages\Schniz.fnm_Microsoft.Winget.Source_8wekyb3d8bbwe;

Note, there is no C:\Users\ianvs\AppData\Local\fnm_multishells\536_1740402936471;

@18964154265
Copy link

At first I also encountered the same problem and I tried adding path of node.exe to os path and solved. However, I could not solve the same for npm.

@thnhan1
Copy link

thnhan1 commented Feb 28, 2025

Everyone starts from zero, but it's wonderful if you know how to use StackOverflow instead of GitHub Issues.

Solution in Stackoverflow
Result:
Image

@IanVS
Copy link
Author

IanVS commented Feb 28, 2025

Thanks for the condescension, but this solution workaround is temporary and does not persist when opening another PowerShell terminal.

There are docs for adding some lines to the profile to achieve completions (it's at least under the "##Completions" heading). Maybe that step is required for using fnm at all with PowerShell? If so, it seems like it should be mentioned higher in the installation steps, and also included in the instructions in https://nodejs.org/en/download.

By creating an issue, I'm alerting the maintainer that there is a problem, or at the very least some friction, which users are experiencing that they can choose to then address or not.

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

No branches or pull requests

8 participants
@futurist @Schniz @IanVS @Evansch0 @devKarin @18964154265 @thnhan1 and others