fnm
fnm copied to clipboard
Add powershell script for installation on windows
This adds a powershell script for installing fnm on windows. The ps script tries to follow the bash script as much as possible. Supported flags are:
- -version | -v for setting version (string)
- -skipShell | -s for skipping shell setup (bool)
- -installDir for setting installation dir (string)
Using only one -
seems odd to me but thats how powershell parses arguments. As far as i've tested, it even works with only the first argument too, as in -version
, -v
and -V
all do the same thing.
To install fnm via the script, users would do
$ irm url/to/the/script | iex
The bash script uses the install
endpoint, the ps script could do ig https://fnm.vercel.app/install.ps
or something.
I've tested the script a few times and ensured that it works.
⚠️ No Changeset found
Latest commit: 311976c6ddb5627b109b350325fa6d69e6457fea
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
First of all, I'd like to thank you for the time and effort and making the hard thing possible and contributing!
However, in my opinion, any installation script is a toll and out of this project scope, and I originally built the installation script to ease the installation process and it only makes sense for Linux nowadays. Since Windows has WinGet baked in as a standard installation mechanism, I don't really see the point in having a custom PowerShell installer. Do you? can you please explain why should we have an installation script and not offload to WinGet?
ig stuff like scoop and winget does exist which allows people to install fnm. But i dont think everyone uses them. Winget is certainly popular but its yet to be used by everyone, while powershell is always there in windows and a one liner script can just be used to quickly do installations. package managers are great but you wouldnt install one just to get a single app. the script itself wasnt much work, if u wanna use it, sure. if not then its all good. tldr theres no disadvantages but nor too many advantages either. good when u need it done quick, thats all.
can you please explain why should we have an installation script and not offload to WinGet?
Hi @Yakiyo, I would like to install fnm under %HOMEPATH%/.fnm
and node versions under %HOMEPATH%/.fnm/versions
(or something like that). -installDir
would allow me to do that, but winget doesn't.
Also, since the bash script install fnm under $HOME/.fnm
I don't understand why on Windows in installed under %APPDATA%/fnm
.
It should be, by default, under %HOMEPATH%/.fnm
.
The homepath approach is an approach also used by pyenv-win.
Am I missing something?
Also, since the bash script install fnm under
$HOME/.fnm
I don't understand why on Windows in installed under%APPDATA%/fnm
. It should be, by default, under%HOMEPATH%/.fnm
. The homepath approach is an approach also used by pyenv-win.
Actually default was changed a while ago and now bash script prefers $XDG_DATA_HOME/fnm
(which is roughly an equivalent to %APPDATA%/fnm
) for fresh installations. It uses $HOME/.fnm
for backward compatibility only if the directory already exists.
See https://github.com/Schniz/fnm/blob/master/.ci/install.sh#L8-L16
Actually default was changed a while ago and now bash script prefers $XDG_DATA_HOME/fnm (which is roughly an equivalent to %APPDATA%/fnm) for fresh installations.
Okay, now it is clear; I based my previous sentence on the README file without opening the actual scripts. Thanks for your reply.