I am trying to run some shell commands on Linux under electron js that required Root Permissions.
If I run "Sudo electron ." then it works
If I create a build for Linux deb file like
"linux:build": "rm -rf dist && electron-packager . App --platform linux --arch x64 --out dist/ --no-sandbox"
"linux:deb": "electron-installer-debian --src ./dist/App-linux-x64/ --arch amd64 --no-sandbox --config linux.json"
Then Deb file is created, when I installed it then how I can run this app as a root user?
If I try to open this app with sudo App then it throws an error of
Running as root without --no-sandbox is not supported. See https://crbug.com/638180
In case of it's run like this, I don't think it's good practice that user will open app like this. How we can create Linux package that uses root permissions?
I also tried with package sudo-prompt and electron-sudo But it asks for admin password again and again as per commands will run. It should be asking for once.
Can anybody help me with this?
Looking forward to hearing from you guys!
Related
I have a program written with node js that I want to bundle and distribute as "stand-alone" executable program.
I want to run the program through cmd only with the the executable file name (without using npm run start or node file.js). i.e. my_program arguments.
What is the most recommended way to achieve this?
Thanks.
There are several options you can choose from. I would recommend checking out Pkg.
With Pkg, you can package your node application into a single executable for Windows, Linux or Mac.
Simply install Pkg globally on your machine by running the command:
npm install -g pkg
and then add your point of entry to the package.json file as shown below:
{
"bin": "bin.js" // or whatever your point of entry is
}
Afterwards, from your app directory simply run the command
pkg .
This would build the executables for Windows, Linux and MacOS.
You can execute the executable by running:
Windows: your_exec-win.exe # windows
Linux: chmod u+x your_exec-linux; ./your_exec-linux
I want to run "Hello World" electron app in linux (CentOs). I have this folder structure for my app
When I run npm run start, in turn runs electron .
I see the following error
[10948:0114/140415.407127:FATAL:setuid_sandbox_host.cc(157)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /home/staff/kjeeva/simple_electron_app/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755
cd ./node_modules/ electron/dist/
sudo chown root chrome-sandbox
chmod 4755 chrome-sandbox
https://github.com/electron/electron/issues/17972
I have a very simple website built by ExpressJS. I run Docker Quick Start terminal and go to the working directory.
This is the result of ls command
app.js bin/ node_modules/ package.json public/ routes/ views/
When I issue the command below, I get "No such file or directory" error:
docker run -p 8080:3000 -v $(pwd):/var/www -w "/var/www" node npm start
I am using Windows 8.1 Pro 64-bit
What am I missing here?
Make sure that you checked mark your Windows drives in order to accessible for the Docker Engine by going to docker settings => Shared Drives.
Also define the absolute path instead of $(pwd) i.e. d:\express:/var/www. The same issue I confronted a couple weeks ago where I resolved using the above approach.
I am making an application with electron which uses the wiring-pi library. This needs access to the GPIO on my Raspberry Pi, which requires root.
When I run electron . in the folder, the app opens fine but then says (in the terminal):
wiringPiSetup: Must be root. (Did you forget sudo?)
However when I try sudo electron ., I get an error:
sudo: electron: command not found
Does anyone know why this is happening?
Also, for the record, the same thing happens when I run npm as root:
pi#raspberrypi:~/rubiks-robot $ sudo npm
sudo: npm: command not found
Any ideas of how I can fix this issue and run Electron as root?
it looks like a problem of environment variables. The environmnet variables are set for your user but not for root.
Try to ship your variables with the "-E" switch of the sudo command:
sudo -E command
Please try to see here for other similar questions
How to keep Environment Variables when Using SUDO
I was thinking whether we can deploy Meteor.js app doing this:
curl https://install.meteor.com | /bin/sh
meteor create myApp
cd myApp
FTP app files into myApp directory
meteor
I assume you are trying to deploy to your own server. Therefore your need to create the bundle which you can them FTP and expand in your server/directory as follows:
create the bundle: meteor bundle myApp.tgz
FTP myApp.tgz into your server/directory.
Locate the uploaded tar file and extract it with the following command:
tar -zxvf nameofyourapp.tgz
Note: If the machine you developed the application is different than the machine you are deploying to, you will need to rebuild the native package. To do this, enter the bundle/programs/server/node_modules directory.
cd bundle/programs/server/node_modules
Once there remove the fibers directory
rm -r fibers
Rebuild fibers using npm:
npm install fibers
This will install the latest fibers version, specific to the platform you are deploying to.
Best regards,
Vince