-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
previously used node version is not removed from the PATH variable #3561
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Interesting - there's explicit code in nvm to purge the PATH of nvm entries before using a new version. What happens if you manually clear out the nvm stuff from the PATH, and then |
then it's added once. I also noticed that it only happens in vscode terminal, but not in the system terminal |
oh interesting. so you can't reproduce the problem in a real terminal, but you can consistently reproduce it in vscode's terminal? |
exactly! |
After restarting the terminal: v16.20.2 |
@xianghongai same problem for you? works on the real terminal, not on vscode's? |
Hi, I'm new to programming and open source development world, so I don't know if this is actually useful, but anyway, I ran the following test:
It seems like VSCode retains the inicial PATH for new terminal sessions. That inicial PATH persists during VSCode running, and only updates when I close and reopen it. I ran the test changing steps 3 and 4 (marked with a ⭐). Instead of using the system terminal, I used the VSCode terminal:
|
Sounds like it's vscode-specific behavior, then, that nvm wouldn't be able to fix. |
I was wrong. I ran a simple test in VSCode terminal by modifying the PATH in
So, if that isn't a VSCode issue, maybe it's reproducible in another similar environment. Then, I ran the same 8 steps of my previous comment, replacing VSCode with Tmux. And yes - the same issue: I also need to create a completely new session to have it initialized with the new |
I have the same problem |
Just chiming in, I can also reproduce this issue on a real terminal, not VSCode (Ghosstty terminal to be exact). Steps:
Note the path still contains reference to v16.20.2 node, which is what was set before using Also as @xianghongai described, new terminals aren't respecting the |
Operating system and version:
macOS
nvm debug
output:nvm ls
output:How did you install
nvm
?curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash
What steps did you perform?
nvm install 20
nvm install 22
nvm use 20
What happened?
PATH variable is polluted with bin paths of the previously used node.
What did you expect to happen?
PATH to only contain selected node
Is there anything in any of your profile files that modifies the
PATH
?no
The text was updated successfully, but these errors were encountered: