ボクココ

個人開発に関するテックブログ

grunt server で command not found xdg-mime , xdg-open: no method available for opening

これ、調べたらPhamtom.jsでブラウザを使うらしく、そこで使われるコマンドの模様。
確かにこの環境のサーバには何一つブラウザは入っていない。

てことでChromeをインストール
http://www.cyberciti.biz/faq/how-to-install-google-chrome-in-ubuntu-linux-12-xx-13-xx/

これを入れたら、 xdg-mime も勝手に入ってきた!

あとopen:serverのTaskで
xdg-open: no method available for opening
ってエラーもでた。

これはスクリーンを起動していないからだそうで、以下のコマンドで解決できた。


Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
export DISPLAY=:99.0


grunt server
Running "server" task

Running "clean:server" (clean) task
Cleaning .tmp...OK

Running "concurrent:server" (concurrent) task

Running "copy:styles" (copy) task


Done, without errors.

Elapsed time
copy:styles 30ms
Total 31ms

Running "coffee:dist" (coffee) task

Done, without errors.

Elapsed time
coffee:dist 37ms
Total 37ms

Running "compass:server" (compass) task
directory .tmp/styles/
create .tmp/styles/main.css (1.056s)
Compilation took 1.06s

Done, without errors.

Elapsed time
compass:server 2s
Total 2s

Running "autoprefixer:dist" (autoprefixer) task
File ".tmp/styles/main.css" created.

Running "connect:livereload" (connect) task
Started connect web server on localhost:9000.

Running "open:server" (open) task

Running "watch" task
Waiting...

おっけー!


参考元:
http://webtech-walker.com/archive/2013/04/xvfb-js-unit-test.html

追記:
自分の環境はVirtualboxからUbuntu立ち上げてそこからブラウザアクセス、といった開発スタイルだったのですが、それだとこのUbuntuのうらっかわで立ち上がっているブラウザと連携したGrunt serverにアクセスできず。。
ということでUbuntuデスクトップを立ち上げて、そこのブラウザとGrunt serverを連携させて問題を解決しました。