Search code examples
ionic-frameworkelectroncapacitor

How to run electron as root


I try to run electron on may kali linux as where I am the root but it doesn't show anything but it works on my ubuntu where I am not the root.

When I run: npm run electron:start

I get this:

11640:0227/233443.028885:FATAL:atom_main_delegate.cc(211)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

help me please.


Solution

  • The only solution I found is to do it without being root. And until then for it to work when you execute the command "

    npx cap open electron

    ", you must locate the directory of the chrome-sandbox file in the error message where you will have to execute the following two commands:

    sudo chown root: root chrome-sandbox
    sudo chmod 4755 chrome-sandbox
    

    Generally, here is what I do to use ionic and electron on Kali linux:

    1. npm install ngx-electron electron
    2. npm install electron-packager --save-dev
    3. ionic build
    4. npx cap add electron
    5. ionic build && npx cap copy
    6. npx cap open electron
    

    You can see here for more explanation: https://gist.github.com/gnopor/d4813628c949294c4ef8b4ef88941f68