How do you run as sudo in the web terminal in Theia - theia

How do you run as root in the web terminal of Theia?
Just want to update golang - one other way is to update/copy the Dockerfile: https://github.com/theia-ide/theia-apps/blob/master/theia-go-docker/Dockerfile
But it would be nice to run as root in the terminal!

Get rid of RUN adduser... and USER theia. BTW there is a better image now which support go vscode extension: https://github.com/theia-ide/theia-apps/pull/146 So you even can debug Go.

Related

vscode opens a white screen when running in super-user mode

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

Not being able to start vscode in root mode in Ubuntu 20

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

Flutter and Dart -> add path on Ubuntu 20.04

I am trying to add flutter to the path but no solution is working for me right now. It was working before when I installed it from snap. Now I am cloning flutter repo into the opt folder and No matter what I try, flutter is not working. I am using ZSH terminal.
So far I have tried:
Adding export PATH=~/opt/flutter/bin:$PATH on last line of .zshrc and .bashrc file.
Running export PATH="$PATH:~/opt/flutter/bin" on the terminal.
And bunch of other tweaks on the keywords but none of the things seems to work.
Try this if you mean you have cloned flutter to /opt folder
export PATH="$PATH:/opt/flutter/bin"
Also if you doesn't mean that and you solely mean ~/opt folder then first verify your flutter installation by typing
~/opt/flutter/bin/flutter
in your terminal,
It should launch flutter it your terminal if not then either your installation is broken or you have to type
chmod +x -R ~/opt/flutter/bin
to make flutter executable if it's not.
PS: Also don't forget to restart your shell if you haven't cause you have to restart you shell after changing something in your .rc files.
I hope I have helped you if not please comment so that I can improve the answer.
This work on Ubuntu.
Add to file .profile the following line:
export PATH="$PATH:/home/your_user_name/opt/flutter/bin

nodemon "restarting due to changes..." repeatedly displays in VSCode and slows down every restarting process

I use nodemon version 1.18.9 (Latest version as of today).
I use Visual Studio Code (VSCode). I open a terminal and execute nodemon dev-server.js but it displays this repeatedly
restarting due to changes...
as follows
and after a few seconds it will complete its restarting process.
I use Windows 10.
Any suggestions?
package.json
{
"scripts": {
"nodemon": "nodemon dev-server.js"
},
}
start nodemon by npm
$ npm run nodemon
save dev-server.js file, nodemon will restart twice
start nodemon direct
$ nodemon dev-server.js
save dev-server.js file, nodemon is all right
osx 10.11.3
nodemon 1.9.2
=============UPDATED ANSWER FROM COMMENTS======================
updating answer from comments as logic from comments worked for this problem.
try adding delay for some time. let me know if it works.
nodemon lib/dev-server.js --delay 1 ..
whatever your directory is.
I guess you have to change the settings on the VSCode, go to File->Auto Save(unmark the option). After that the project will restart only when you use ctrl+s on the specific path.
Edit: I did some tests on my computer and I reproduced what you trying to mean, probably you are trying to use diferent extensions that nodemon does not support.
Take a look on this part of the documentation:
Specifying extension watch list By default, nodemon looks for files
with the .js, .mjs, .coffee, .litcoffee, and .json extensions. If you
use the --exec option and monitor app.py nodemon will monitor files
with the extension of .py. However, you can specify your own list with
the -e (or --ext) switch like so:
nodemon -e js,jade Now nodemon will restart on any changes to files in
the directory (or subdirectories) with the extensions .js, .jade.
try to run nodemon -e ts,json(all extensions that you want to be listener) dev-server.js. When I removed the extension I got the same issue of you.
please set Windows Environment Path
Right Click PC/My Computer
Properties
Environment
Path --> Edit --> New
Paste:- C:\Windows\System32
ok
then restart VSCode
Try to build your application without using nodemon
Correct the errors, which may be the result of tslint being unable to fix something and generating a syntax error
Restart your application with nodemon

Can't put MongoDB in my PATH

I'm trying to include MongoDB in my PATH on Ubuntu 14.04 by issuing this command:
export PATH=/home/<my-user-name>/mongodb-linux-x86_64-ubuntu1404-3.2.4/bin:$PATH
It seems OK but when I restart the terminal it can't find it again. Do you have any idea what's going on?
export commands only work for the current terminal window.
You should add this command to one of the files that run when you start your terminal session.
Your best choice would be to add this line to a file called ~/.profile, since it will run regardless of the shell you are using.