You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the fnm exec command, the PATH variable is set to a value which includes both the version being used and the active multishell.
This is confusing, as we can end up using a command associated with a different node version to the one passed into fnm exec.
Proposed Solution
I think that the way to fix this would be to change the code here which builds the path for an exec command, so that it removes the active multishell from the path as well as adding the version we are using for the exec to the path.
If that is sensible, I am happy to put up a PR.
Example to Reproduce
# Start with no node versions installed (and yarn not available from the system)
$ fnm list
* system
$ which yarn
yarn not found
# Install two versions of node
$ fnm install 14.21.1
$ fnm install 18.16.1
$ fnm list
* v14.21.1 default
* v18.16.1
* system
# Install yarn on version 14
$ fnm use 14.21.1
Using Node v14.21.1
$ npm install -g yarn
...
added 1 package in 0.478s
$ which yarn
/Users/me/Library/Caches/fnm_multishells/7130_1707823268447/bin/yarn
# If we switch to version 18, we cannot find yarn, but can find the version 14 one with exec
$ fnm use 18.16.1
Using Node v18.16.1
$ which yarn
yarn not found
$ fnm exec --using 14.21.1 which yarn
/Users/james.owen/Library/Application Support/fnm/node-versions/v14.21.1/installation/bin/yarn
$ fnm exec --using 18.16.1 which yarn
# If we switch to version 14, we can find yarn when we exec against either version, falling back to the one from the shell
$ fnm use 14.21.1
Using Node v14.21.1
$ fnm exec --using 14.21.1 which yarn
/Users/james.owen/Library/Application Support/fnm/node-versions/v14.21.1/installation/bin/yarn
$ fnm exec --using 18.16.1 which yarn
/Users/james.owen/Library/Caches/fnm_multishells/7130_1707823268447/bin/yarn
$ which yarn
/Users/james.owen/Library/Caches/fnm_multishells/7130_1707823268447/bin/yarn
The text was updated successfully, but these errors were encountered:
Summary
When using the
fnm exec
command, thePATH
variable is set to a value which includes both the version being used and the active multishell.This is confusing, as we can end up using a command associated with a different node version to the one passed into
fnm exec
.Proposed Solution
I think that the way to fix this would be to change the code here which builds the path for an
exec
command, so that it removes the active multishell from the path as well as adding the version we are using for theexec
to the path.If that is sensible, I am happy to put up a PR.
Example to Reproduce
The text was updated successfully, but these errors were encountered: