xdg-open : no method available even after installing xdg-utils
Asked Answered
E

4

12

I am using generator-angular-fullstack. On my local machine its working fine, I run

 grunt serve

it starts server but in VPS it's failing

Warning: Command failed: xdg-open: no method available for opening 'http://localhost:9000'

and I have already installed xdg-utils

 $ sudo apt-get install xdg-utils
 Reading package lists... Done
 Building dependency tree       
 Reading state information... Done
 xdg-utils is already the newest version.

Can any one explain me what I am doing wrong?

Ethno answered 10/7, 2014 at 17:53 Comment(1)
Are you sure you have xdg-open installed? Try to run it from console. Second suggest: try to change hostname to "0.0.0.0". And show us Gruntfile please.Rosewood
L
1

Are you using graphical environment? If you are using "raspberry" and you are connecting via ssh and you have no "grunt" configured to use PhantomJS, "Grunt" can not perform the task. You have to force him to continue to "serve --force grunt" or set the "Gruntfile.js"

Lydell answered 28/5, 2016 at 14:33 Comment(1)
Since the question was so long ago I can't test the answer. Yes, I was not using GUI interface. Maybe that's the reason.Ethno
H
9

Have you tried configuring the xdg-open handlers?

Also, have you ensured you have a browser installed on your server? Installing a new browser with apt-get install <browser> should automatically make xdg-open aware of it. However, your setup may not have done this depending on the order that your browser/xdg-utils were installed.

To make things sane again requires running xdg-settings.

To set an http:// handler to your preferred browser (which on a headless server is likely to be w3m, lynx or elinks), do the following:

xdg-settings set default-web-browser w3m.desktop

To verify, you can run xdg-open https://stackoverflow.com/questions/24683221 and you should see your answer in w3m.

If you don't have w3m available, install it with sudo apt-get install w3m

You may wish to see other available handlers by running xdg-settings --list, which on my system, outputs the following:

Known properties:
  default-url-scheme-handler    Default handler for URL scheme
  default-web-browser           Default web browser

EDIT: It turns out that some old systems (ubuntu 10.04) don't have xdg-settings, and that the update-alternatives command should automatically configure xdg-open. Like so:

    sudo update-alternatives --config www-browser
Hidden answered 24/7, 2014 at 19:58 Comment(0)
I
5

I'm not an expert with xdg-open but I will give this a try. It looks like there is a problem with your package database. Also, showing the gruntfile would make things easier.

Here are the steps to follow:

  1. Identify all xdg-open's.

    $ type -a xdg-open

    xdg-open is /usr/bin/xdg-open

  2. Find out which packages they're a part of.

    $ dpkg -S /usr/bin/xdg-open

    xdg-utils: /usr/bin/xdg-open

  3. You'll want to either repeat the above dpkg -S .. for each match returned by type -a or use this dpkg -S .. search instead. I would do each, one at a time.

    $ dpkg -S xdg-open

    xdg-utils: /usr/bin/xdg-open

    xdg-utils: /usr/share/man/man1/xdg-open.1.gz

  4. Reinstalling xdg-utils. If you'd like to refresh this package's installation do this:

    $ sudo apt-get install --reinstall xdg-utils

I hope this helps!

Installment answered 24/7, 2014 at 19:38 Comment(3)
the correct way to reinstall a package is sudo apt-get install --reinstall xdg-utilsBarri
@sdotdi See step 4 of my answerInstallment
Copy and paste it to the terminal until you see what I meant.Barri
L
1

Are you using graphical environment? If you are using "raspberry" and you are connecting via ssh and you have no "grunt" configured to use PhantomJS, "Grunt" can not perform the task. You have to force him to continue to "serve --force grunt" or set the "Gruntfile.js"

Lydell answered 28/5, 2016 at 14:33 Comment(1)
Since the question was so long ago I can't test the answer. Yes, I was not using GUI interface. Maybe that's the reason.Ethno
M
0

I did sudo apt install wslu like mentioned here and it seems to fix it.

Meerkat answered 5/1 at 12:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.