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?

Neo
  • 4,550
  • 6
  • 34
  • 51
  • 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. – raidendev Jul 24 '14 at 07:11

3 Answers3

8

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
4

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!

rayryeng
  • 102,964
  • 22
  • 184
  • 193
Redson
  • 2,098
  • 4
  • 25
  • 50
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"

Baurin Leza
  • 2,004
  • 1
  • 13
  • 15
  • 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. – Neo Jun 03 '16 at 09:30