Schniz / fnm

🚀 Fast and simple Node.js version manager, built in Rust
https://fnm.vercel.app
GNU General Public License v3.0
18.1k stars 459 forks source link

failed to fnm exec npm in git bash #1076

Open tiger8888 opened 10 months ago

tiger8888 commented 10 months ago

[~] 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

Aalivexy commented 10 months ago

same on msys2

Aalivexy commented 2 months ago

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;