failed to fnm exec npm in git bash
[~] uname -a
MINGW64_NT-10.0-17763 DESKTOP-DN5S7E6 3.3.6-bec3d608-341.x86_64 2023-02-22 08:29 UTC x86_64 Msys
[~] which npm
/c/Users/Tiger/\Users\Tiger\AppData\Local\fnm_multishells\12656_1702534701888/npm
[~] which node
/c/Users/Tiger/\Users\Tiger\AppData\Local\fnm_multishells\12656_1702534701888/node
[~] fnm exec --using=v14.21.3 node --version
v14.21.3
[~] fnm exec --using=v14.21.3 npm --version
error: Can't spawn program: program not found Maybe the program npm does not exist on not available in PATH?
[~] npm -v
6.14.18
same on msys2
I think this issue may be related to https://github.com/Schniz/fnm/issues/390, I solved it using the following method:
# ~/.config/fish/conf.d/fnm.fish
fnm env --use-on-cd | /usr/bin/sed 1d | source;
set -gx PATH (/usr/bin/cygpath -u $FNM_MULTISHELL_PATH[2]) $PATH;