Open Scotchester opened 1 month ago
Looking at the recent changes to the installer, it appears that this may have have been introduced in #937. A simple fix might be to re-set INSTALL_DIR
when doing a Homebrew installation, but you'd also want to avoid re-adding the Homebrew bin to the PATH
, since it's already there.
I can confirm this does happen on the current homebrew version 1.37.1.
This is especially bad because if you follow the official guide from nodejs website, you'll end up with a borked installation:
# installs fnm (Fast Node Manager)
curl -fsSL https://fnm.vercel.app/install | bash
# download and install Node.js
fnm use --install-if-missing 20
The second command will install node in a wrong (default) directory, while your .zshrc will be setting the wrong path:
FNM_PATH="/Users/username/Library/Application Support/fnm"
if [ -d "$FNM_PATH" ]; then
# ...
# will not happen as the directory does not exist
I have the same situation and getting error like
❱ fnm use
error: We can't find the necessary environment variables to replace the Node version.
You should setup your shell profile to evaluate `fnm env`, see https://github.com/Schniz/fnm#shell-setup on how to do this
Check out our documentation for more information: https://fnm.vercel.app
Thank you
faced this as well
quick workaround fix is this one
cd ~
brew uninstall fnm
mkdir .fnm
curl -fsSL https://fnm.vercel.app/install | bash
now it says (i use fish shell):
Installing for Fish. Appending the following to /Users/colch/.config/fish/conf.d/fnm.fish:
# fnm
set FNM_PATH "/Users/colch/.fnm"
if [ -d "$FNM_PATH" ]
set PATH "$FNM_PATH" $PATH
fnm env | source
end
added that into config, and it works :) good luck!
got this by reading source code for install script: https://github.com/Schniz/fnm/blob/119ffc5961c578660f7c34206bc10c8e0eb5d227/.ci/install.sh#L12-L13
I apologize if I'm missing something obvious.
I just tried installing fnm on a fresh MacBook (running macOS Sonoma 14.5) using the default recommended installation script (
curl -fsSL https://fnm.vercel.app/install | bash
). I can see that this uses Homebrew to do the installation. The output looks pretty expected:The problem is, the
/Users/cranfill/Library/Application Support/fnm
directory is not created, so the shell integration code does nothing.which fnm
returns the default Homebrew location:Reviewing the code in the install script, I don't see any situation in which the correct installation directory for a Homebrew install gets used in the shell setup code.