1

I'm trying to deploy to a simple WebRTC.io demo app (https://github.com/dougnukem/webrtc.io-demo) to nodejitsu, but when it's deployed (http://dougnukemwebrtc.jit.su/) it fails to serve the client-side javascript:

Cannot GET /webrtcio.js

It runs fine when I'm running it locally:

$ git clone https://github.com/dougnukem/webrtc.io-demo.git
$ cd webrtc.io-demo/
$ npm install
$ node example/server.js &
$ curl http://localhost:8000/webrtc.io.js
Dougnukem
  • 14,709
  • 24
  • 89
  • 130

1 Answers1

3

webrtc.io.js was actually a symlink, and npm and nodejitsu don't package and deploy those (https://github.com/nodejitsu/jitsu/issues/379).

$ ls -al example/public
webrtc.io.js -> ../../node_modules/webrtc.io-client/lib/webrtc.io.js

So for now I put a workaround as a predeploy/postdeploy hack that copies the actually file into example/public/ from node_modules to be sent to the nodejitsu servers, and then revert it back to a symlink for local dev. There's probably a more elegant solution.

package.json: https://github.com/dougnukem/webrtc.io-demo/commit/3b1073d5b6af78100dd7e018f4a67b078ca552e6

"scripts": {
    "predeploy": "cd ./example/public && rm webrtc.io.js && cp ../../node_modules/webrtc.io-client/lib/webrtc.io.js webrtc.io.js",
    "postdeploy": "cd ./example/public && rm webrtc.io.js && ln -s ../../node_modules/webrtc.io-client/lib/webrtc.io.js webrtc.io.js",
    "start": "node example/server.js"
  }
Dougnukem
  • 14,709
  • 24
  • 89
  • 130