I edit my code inside tomcat root folder. So I need VSCode to run in mode. I used to write sudo code --user-data-dir and VSCode happily started in root mode. However I do not know what exactly happened yesterday and vscode doesn't simply respond. It doesn't start at all and neither is their any error message. Please help. Noob here
Update : I just figured it out. Apparently there has been an update somewhere and now you need to run sudo code --user-data-dir --no-sandbox
i recommend to use alias to run code --user-data-dir="portable-vscode"
for example
echo "alias vscode='code --user-data-dir="portable-vscode" --no-sandbox --extension-dir portable-vscode/" >> /etc/bash.bashrc
Hey bro open the terminal and type sudo code
Related
I've installed vscode on my ubuntu and I'm trying to run it with root privileges.
I understand there is a problem with this version and root privileges.
I use this command from my terminal:
sudo code /my_fils --user-data-dir='.' --no-sandbox
but when running it vscode opens a blank and white screen with super-user definition on top but with nothing else.
I know there was a problem with this configuration and I found this issue in this link :
https://code.visualstudio.com/updates/v1_59#_progress-for-electron-sandbox-support
I've tried the following but the outcome is the same:
sudo chown root /chrome-sandbox
sudo chmod 4755 /chrome-sandbox
running vscode without the root privilege works.
I'm using ubuntu 20.04 and my vscode version is 1.70.2
is there a workaround for it?
thanks !!
Yes, this seems to be an issue try 1.65.x it might run. encountered the same when installing a fluent theme.
Checkout : https://github.com/microsoft/vscode/issues/146847
it's been a long time that i run vscode as root via this command (ubuntu 20.04.4 LTS) :
> sudo code --user-data-dir="~/.vscode-root"
Today, i used the same command to execute vscode as root, but i don't have the same result.
in this time, i have a blank window.
i tried to remove it + remove /$Home/Code and .vscode folder
install it again but i have the same problem,
i tried to use the same command with other flags without being able to solve it.
Flags tried : --disable-gpu /// --disable-features=CalculateNativeWinOcclusion
is there a way to delete (package + config) and all data of vscode to install it properly again ?
screen shot
Any idea ?
Thank you & have a nice day
That works for me on VSCodium:
sudo su -c "codium --user-data-dir="/root" --no-sandbox && sleep infinity"
For some reason, vscode does not start with sudo, but it works calmly with su -c
PS: I do not know if it can be done easier. I needed this to work with git in vscode
When I tried to open vscode in WSL bash on Ubuntu 20.04 using command code ., it failed and the following message was logged:
/mnt/c/Users/john/.vscode/extensions/ms-vscode-remote.remote-wsl-0.50.1/scripts/wslCode.sh: 57: /home/john/.vscode-server/bin/d2e414d9e4239a252d1ab117bd7067f125afd80a/bin/code: not found
I would like to ask how to fix this problem? Thx a lot!
I found the solution. Even though I think that you've already know it.
You need to delete the folder /home/john/.vscode-server/ with sudo rm -rf /home/john/.vscode-server.
Then, you just run code . or try to open any project that you want it.
Then a script will load and will install a new .vscode-server in your machine with the right files.
My settings file looks like this
{
"python.pythonPath": "/home/username/.conda/envs/myenv/bin/python",
"terminal.integrated.inheritEnv": false
}
And I can see the conda environment in the interpreter that I'd like to activate from vscode interpreter selections but whenever I try to run the a cell in vscode I get a long error message.
Activating Python 3.7.7 64-bit ('myenv': conda) to run Jupyter failed with Error: Command failed: . activate myenv && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python /home/username/.vscode/extensions/ms-python.python-2020.8.105369/pythonFiles/pyvsc-run-isolated.py /home/username/.vscode/extensions/ms-python.python-2020.8.105369/pythonFiles/printEnvVariables.py bash: activate: No such file or directory .
I chdecked my $PATH variable and it each directory existed in it. (Looks like how other stack questions suggested it should look as well)
What am I missing? I had it working on a similar machine a couple weeks ago but I can't seem to get it to work now.
I'm on Ubuntu 20.04 if that's important.
I am not completely familiar with the issue, but some digging around lead me to this, try these settings
"terminal.integrated.env.linux": {
"PATH": ""
}
If that doesn't work please reference this link. They seem to be experiencing the same issue as you, but on windows. You may be able to extract more information from it than I could. Sorry if this didn't help.
After messing around quite a bit, I made a new environment and it worked. I'm not sure what I did within that environment to make vscode unhappy with it but vscode didn't like something about it.
Before making the new environment I also ran a few commands including
sudo chown -R $USER:$USER ~/.conda
sudo chown -R $USER:$USER ~/miniconda3
conda update -n base -c defaults conda
I'm not sure what got it to work but I'm happy it's working now!
First of all happy new year to all, I am trying to set Visual Studio Code to start from terminal and using the instructions from VS Code site but editing ~/.bash_profile or ~/.profile file with following command does not work out.
function code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $*; }
So what could be the problem?
Thank you in advance,
You need to refresh your bash_profile after making changes.
. ~/.bash_profile
Solved the problem. After editing the bash_profile. We need to reset the machine to make changes effective
just paste following command to terminal and return. no need to close terminal or restart
source ~/.bash_profile