grunt-open
grunt-open copied to clipboard
How to use this plugin on a docker machine?
This plugin works perfectly on my local machine, however, it doesn't work on my Docker machine. On my local machine the open task
set as following:
server: {
url: 'http://localhost:<%= express.options.port %>'
}
On my Docker machine as following:
server: {
url: 'http://192.168.99.100:<%= express.options.port %>'
}
NOTE: 192.168.99.100 is my VM's ip address on my Mac.
I got the following error:
app_1 | Running "open:server" (open) task
app_1 | Warning: Command failed: /bin/sh -c /www/app/node_modules/open/vendor/xdg-open "http://192.168.99.100:3000"
app_1 | /www/app/node_modules/open/vendor/xdg-open: 1: /www/app/node_modules/open/vendor/xdg-open: xdg-mime: not found
app_1 | xdg-open: no method available for opening 'http://192.168.99.100:3000'
I have been googling for a while but still no luck. Any help would be appreciated.
any solution yet?
@swateek did you ever find a solution? I am having the same issue
@spock123 let me understand this.. you are running an application on docker where the Gruntfile.js fires a web browser to open.. correct?
If that's the case then it won't work.. the docker doesn't have a UI browser to fire up. What I have done now is - my application is a MEAN stack that has been scaffolded with Yeoman. So I dumped this approach and proceeded to make a distribution build which was hosted on nginx.
If this doesn't work, check for the port that is exposed for the web browser. Expose the same for docker too - not sure if this will work, but might.
@swateek yeah, I've now realized why it cannot work.. thanks.. So I just decided to drop it and just start the browser manually. Actually I like this approach better, because the Grunt Open task often opens a new browser window/tab, even if I already have other tabs open on the same page.
Hi guys,
I'm experiencing this issue too, and as the project is not fully in my control I can't just remove grunt-open
plugin from the pipeline. Is there any solution to at least ignore this task when there's no browser in the env, or ignore based on some custom ENV variable?
@ascrazy sorry for responding late.. would it be possible to replace the Gruntfile.js
with a custom one for yourself?