0

I have a project which I was working on a Windows machine, however recently I've had to switch to Linux as my main dev machine and this is causing me some issues when trying to run JS unit tests using some karma launches, especially:

"karma-chrome-launcher" and "karma-firefox-launcher"

When I was still on the Windows machine and used to run tests, Chrome and Firefox used to open automatically to run tests against them, however in Linux I am having an issue where the browsers don't open and they error out - presumably having to do with permissions:

05 06 2019 14:34:11.915:ERROR [launcher]: Firefox stdout: 
05 06 2019 14:34:11.915:ERROR [launcher]: Firefox stderr: Running Firefox as root in a regular user's session is not supported.  ($HOME is /home/myuser which is owned by myuser.)

Same thing for Google Chrome:

05 06 2019 14:34:11.400:ERROR [launcher]: Chrome stdout: 
05 06 2019 14:34:11.400:ERROR [launcher]: Chrome stderr: [23234:23234:0605/143411.177215:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

I'm new to Linux and tried various things such as trying to run using sudo or switching to sudo su first, but none of these seemed to help.

Anyone came across this issue or has pointers on what can be done to run these browsers possibly even without needing SU access?

Thanks

user1809790
  • 1,349
  • 5
  • 24
  • 53

1 Answers1

0

If you must run them as root, do sudo su, then use the cd command with no destination given. Or cd /root

Also, if you run Chrome from the command line, it looks like doing the following may fix it.

$ sudo Chrome --no-sandbox

MegaEmailman
  • 505
  • 3
  • 11
  • I gave this a try however then I have other issues like not able to resolve loaders in '/root' – user1809790 Jun 05 '19 at 13:02
  • Just popped a small edit in that might help you out. – MegaEmailman Jun 05 '19 at 13:06
  • the browser list is defined in karma.conf.js, so i'm not sure how I can add any additional commands when opening or trying to open the browsers unfortunately. I'm not trying to open the browser myself, but rather have the process automated as part of karma. – user1809790 Jun 05 '19 at 13:09