Node and npm are not found in VSCodium's task terminal
- Ubuntu 22.04
- Volta 1.1.1
- VSCodium 1.84.2 installed from snap.
In usual integrated terminal in VSCode (VSCodium):
$ which node
/home/akd/.volta/bin/node
$ echo $PATH
/home/akd/.volta/bin:/home/akd/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
However when running a task, node is not seen. Tasks file:
{
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"command": "echo $PATH",
"problemMatcher": []
},
{
"label": "node",
"type": "shell",
"command": "which node",
"problemMatcher": []
}
]
}
Output of two tasks:
* Executing task: which node
* The terminal process "/usr/bin/bash '-c', 'which node'" failed to launch (exit code: 1).
* Terminal will be reused by tasks, press any key to close it.
* Executing task: echo $PATH
/home/akd/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
* Terminal will be reused by tasks, press any key to close it.
We see that only Volta's path is not there in the $PATH env. Why and whom to blame?
$ grep volta ~/.*
/home/akd/.bash_history:curl https://get.volta.sh | bash
/home/akd/.bash_history:volta install node@18
/home/akd/.bash_history:volta
/home/akd/.bashrc:export VOLTA_HOME="$HOME/.volta"
/home/akd/.profile:export VOLTA_HOME="$HOME/.volta"
Thanks for the report. At first blush, this looks like a case where VSCodium is not inheriting the PATH from your host environment's shell correctly specifically in the context of the task runner. You might check the issues list on VS Code itself to see if this is a more general issue there. 🤔 The other thing to check is exactly how your base shell is being configured in your base shell.
Thanks for the suggestion. I'll check the VSCode issues list.
The other thing to check is exactly how your base shell is being configured in your base shell.
Couldn't understand that. Please rephrase.
Hahahaha that is fair. "How your base shell is being configured in your base shell" is nonsense. I think I had done too much issue triage by the time I wrote that. 😂
What I meant was "The other thing to check is exactly how Volta is being configured in your base shell", i.e. your login shell or wherever Volta is configured on your system's PATH in general.
I'm also facing this issue, did you manage to fix it? Just in Codium but not in Code
I'm also facing this issue, did you manage to fix it? Just in Codium but not in Code
Not yet. I had no chance to look into it closer as I was mostly working on Windows last month. Though, I'm keeping this in my TODO list.
I can see here that inside VSCodium your path is
/home/akd/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
but in your normal PATH it is
/home/akd/.volta/bin:/home/akd/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
so in VSCodium you're missing /home/akd/.volta/bin , restart of PC/tool/terminal should help probably
so in VSCodium you're missing
/home/akd/.volta/bin, restart of PC/tool/terminal should help probably
It seems that [unintentionally] restarting the PC helped. I never supposed that this may happen with Linux! Originally, of course, I've relaunched the VSCodium, and that didn't help.
Or maybe something is fixed in the Code. Who knows. Anyhow, the issue went away on its own without my intervention.
I never supposed that this may happen with Linux!
you are logged in to desktop... so also logout/login should fix it... it is not like new terminal :)