-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
fnm download snippet fails on Windows #7487
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
Comments
IIUC we need to add the following line: 'fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression' >> $PROFILE Does executing that fix the issue? |
No response from OP, I'm going to verify this solution today, and if it does work, I'll send a PR accordingly |
Sorry. I somehow missed your post. I will see if I can test your solution. |
Unfortunately just adding 'fnm env --use-on-cd --shell powershell | Out-String | Invoke-Expression' >> $PROFILE to the script does not solve all the issues. It seems that there are multiple barriers to providing a script which runs error free in one single invocation on a freshly installed Windows system and sets up I don't know if there is any simple solution to this.
Edit: The above refers to testing on Windows 11 24H2. |
wow! There are several levels to this issue. @Schniz do you happen to have a simple script, assuming the user is installing on a PS7+ shell? |
The way I see it, On the + side:
On the - side (for Windows only):
(Bullets 1 and 2 refer to https://github.com/Schniz/fnm/tree/master?tab=readme-ov-file#powershell) |
Microsoft recommends other Node.js version managers: See https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows |
FYI nvm-windows is on maintenance mode and being superseded by https://github.com/coreybutler/nvm-windows/wiki/Runtime |
If there is any discussion about replacing fnm as a Windows recommendation, that should probably be done under a different issue. (FWIW: I actually use an older version of [email protected] for my own daily work.) This issue should really be focused on getting a working set of instructions to use fnm for Windows. If there is no automated way to do this for Windows, then perhaps just some extra text would need to be added to the instructions. Something like: "# Visit https://github.com/Schniz/fnm for additional setup instructions" # Download and install fnm:
winget install Schniz.fnm
# Visit https://github.com/Schniz/fnm for additional setup instructions
# Download and install Node.js:
fnm install 22
# Verify the Node.js version:
node -v # Should print "v22.13.1".
# Verify npm version:
npm -v # Should print "10.9.2". |
That would work I suppose, but IMHO we shouldn't outsource information for installing content. @ovflowd WDYT about removing fnm from Windows (but not POSIX, as it works fine for those), and moving it to the All download methods page? |
Afaik we are strongly opposed on redirection. We must provide a minimal set of instructions. We of course cannot cover every single terminal app/emulator people are using hence we need to make drawbacks or decide which environment we assume users are. The same applies for Linux. We cant provide support to the whole umbrella of the shell systems out there 😅 |
@nodejs/nodejs-website 👍 — Support removing fnm from the Windows installation instructions. 👎 — Oppose removing fnm; prefer to improve the existing instructions. 😕 - Move fnm from an official installation to a community installation; improve the existing instructions. 🚀 - Neutral ❤️ - Reach out to the maintainer of the project for additional insight. |
Why would this be done, what criteria that fnm originally met does it no longer meet? |
None, I was just listed all possible scenarios |
With this correction in the command, I confirm it's working :) |
That doesn't solve our issue, however, which is that the command in that PR needs to be added to shell specific config file, which can be poor DX for users to find. IMHO @Schniz should make it part of the installation that the profile be updated, it would solve all these issues. By the way, thanks for voting, it's nice to see where everyone is at :-) |
Yes, +1 that this should be part of the winget installation to set the profile up appropriately automatically for the user -- the fnm README actually implies that this will be done, the winget install instructions do not point the user to the shell setup unlike other installation methods. |
I am not maintaining the choco or winget installers, nor I know how they work as I haven’t used Windows for more than a decade. They are not a part of the fnm repo too. Contributions to these installers are welcome. If you know any way of moving the sources of these installations to the fnm repo, we could actually own it and have changelogs there etc. Let me know exactly how you want to act on this, and we can fix it. I’m not a part of that ecosystem so it would be helpful to get your help on that ;-) |
What I can say about the homebrew ecosystem (aka macOS) is that it’s not allowed to set up profile in homebrew formulas afaik. Maybe winget is the same. We can maybe create “fnm init” that’ll setup fnm for all known shells. What do you think about it? |
I'm also not in the Windows world, but my gut says the best approach might be to land Schniz/fnm#1018 or some version thereof, so that you have your own install script that folks can run similar to what you recommend for Linux/macOS -- that script can then do the full install including the profile, and the winget etc. can remain the "same" as homebrew etc. in just installing the tool itself? |
Heya everyone! As @MattIPv4 said, landing that script (or some variant of) would be ideal. The WinGet installers can be set to execute said script if that's the direction you are going for, but one way or another, an automated install significantly improves DX |
I’ll try to merge the PR mentioned next week. I’m currently celebrating Passover with my family but I understand the importance and I do it once I’m back |
Appreciate your time here, @Schniz! |
URL:
https://nodejs.org/en/download
Browser Name:
Microsoft Edge
Browser Version:
133.0.3065.59 (Official build) (64-bit)
Operating System:
Windows 11 24H2 10.0.26100.3037
How to reproduce the issue:
Steps
Copy and run the download instructions from https://nodejs.org/en/download for Windows using fnm with npm in a PowerShell terminal:
Expectation
The snippet should run without error.
The implicit assumption of offering a "Copy to clipboard" button with a label "PowerShell" is that the shell script can be copied and run as-is.
In fact, a user needs to visit https://github.com/Schniz/fnm/blob/master/README.md and navigate a complex set of instructions to set up fnm to work on Windows.
Actual
Related
The text was updated successfully, but these errors were encountered: