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
Related
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!
i have a repo for an electron project ive been able to run in ubuntu subsystem before fine, im on a new pc now and having trouble. I already ran npm i, but when I run electron . i get this err:
martin#DESKTOP-URPCCBK:/mnt/c/Users/marti/Documents/projects/electron-upload-manager$ npm start
> drag-and-drop#1.0.0 start /mnt/c/Users/marti/Documents/projects/electron-upload-manager
> electron .
[5094:0907/143024.016724:FATAL:setuid_sandbox_host.cc(158)] 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 /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.
so i ran
sudo chown root /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox
and
sudo chmod 4755 /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox
then ran npm start again, and get:
martin#DESKTOP-URPCCBK:/mnt/c/Users/marti/Documents/projects/electron-upload-manager$ npm start
> drag-and-drop#1.0.0 start /mnt/c/Users/marti/Documents/projects/electron-upload-manager
> electron .
[5120:0907/143308.127280:FATAL:setuid_sandbox_host.cc(158)] 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 /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.
I did what the error asked, but still got the error? Ive tried removing my node_modules, reinstalling with npm i, running apt-get update, installing electron globally but still am getting this err
You need to enable metadata on DrvFs. Put this in /etc/wsl.conf:
[automount]
options = "metadata"
After this, chmod/chown should work on windows files. See this Microsoft blogpost for more details.
Try this command. It is a work-around:
sudo sysctl kernel.unprivileged_userns_clone=1
ill just run it in command prompt instead, got it working fine there
I am using Windows 10 and I have installed Node.js (with npm) on my local machine. I am trying to follow an instruction which says:
"Once node.js and npm are installed, run the following command in your terminal.
npm install -g live-server
This will install live-server⁵, a simple static server that has live reload built-in. To
start your server, run live-server in your terminal from the root /code folder —
it will even open a new browser window for you!"
Since I am on Windows, I guess "Terminal" means "Command Prompt". So, I have run the "npm install -g live-server" from C:// prompt.
I am now confused about the part where it says "run live-server in your terminal from the root /code folder".
What is the root /code folder?
In the command prompt, either cmd.com or Windows terminal (yes, the new one actually has the word "terminal" in its name), cd to your project directory (referred to by the docs as the "root" or "code" folder) then type:
live-server
It is literally installed as a command just like cd, dir etc.
The "root" folder or "code" folder is literally the folder where you saved your index.html file.
Root folder is where your index.html is saved.(from which your code runs). You can use cd ../ to change your folder and get to root. After which you can easily run live server.
Go to your root folder of your project and run
npm install live-server
To start live server run:
npx live-server
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'm on cygwin to do unix commands on win7 (launched cygwin.bat in windows cmd prompt).
My project directories are created in root like this:
$ mkdir -p app/models
$ mkdir -p app/node_modules
Then the symlink is created:
$ cd app/node_modules
$ ln -sf ../models
Back on the /app/ directory, I go into Node console to launch the module located in
app/models/movie.js:
Movie = require('models/movie');
But I get the following error:
Cannot find module 'models/movie'
ln takes 2 arguments, not one.
I found out that cygwin doesn't really create actual symlinks by default. I had to create native NTFS symlinks using export CYGWIN="winsymlinks:native"