質問

I'm trying to get a simple node.js example working on nitrous.io. I've pretty much just followed the yeoman tutorial with the angular template. I've had to modify my localhost to 0.0.0.0 and change my liveReload port to 4000. I also had to run grunt server with a --force command because I get the following error:

Warning: Command failed: /home/action/workspace/node-test/node_modules/grunt-open/node_modules/open/vendor/xdg-open: 1: /home/action/workspace/node-test/node_modules/grunt-open/node_modules/open/vendor/xdg-open: xdg-mime: not found   

After jumping through these hurdles live reload doesn't seem to work. Does my "box" need to have xdg-mime or xdg-utils installed for this to work? The file watcher appears to notice the change but the webpage does not update after any of the js polling.

(I'm new to all of these technologies, but it seems like this tutorial example should work)

Edit: After help from Sindre I no longer have the, now obviously simple (hindsight), issue with missing xdg-mime but I do have an issue with live reload not working

役に立ちましたか?

解決

Per Nitrous.io support

The issue here is that websockets is blocked on Nitrous servers, which only HTTP ports 3000 - 9000 are open at this time. Live reload needs to run HTTP and WebSockets on the same port in order to function.

WebSocket support may be something we will be adding in the near future

他のヒント

It needs XDG, which is installed by default on most systems, to be able to open it up in the browser.

As you have discovered, LiveReload requires WebSockets, which Nitrous does not support out of the box. However, there is good news: you can get them to work by forwarding through an SSH tunnel. I have written up more detailed instructions on Coderwall.

I needed to install xdg-utils to fix this:

Running "open:server" (open) task
finished populating things
Warning: Command failed: /generator-test/node_modules/grunt-open/node_modules/open/vendor/xdg-open: line 584: xdg-mime: command not found
xdg-open  no method available for opening 'http://localhost:9000'
 Use --force to continue.

./xdg-open: line 584: xdg-mime: command not found
xdg-open  no method available for opening 'http://www.google.com'

node_modules/open/vendor/ contained xdg-open, but not xdg-mime.

The remote server I am using did not have have xdg-utils installed... not sure why xdg-mime was missing from the node_modules dir...

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top