"cordova-hcp server" not starting the HCP server
happy-dev opened this issue · comments
Hi,
First of all, thank you for this great plugin which helped me save hours so far.
Since this morning though, the HCP server refuses to start. I tried several thing, including :
- killing the service which I didn't find
- restarting my machine
- reinstalling cordova-hot-code-push-cli
- reinstalling ngrok
I am kind of stuck... What happens is the following :
Here is what happens :
[root@happydev mlb_cordova]# cordova-hcp server
Running server
[root@happydev mlb_cordova]#
I am not sure where to look for logs.
I am willing to help out. If one could give me some tip that could get me going. Any suggestion is most welcome.
I have been having the exact same problem since around yesterday morning.
I also tried similar steps to you to try to resolve things, no luck though.
Poking around in dist/server.js it seems that of the 5 functions pushed onto the 'funcs' array, only the first is ever executed. ie, from line 37:
function execute(context) {
chcpContext = context;
ignoredFiles = context.ignoredFiles();
chcpContext.argv.localdev = true;
sourceDirectory = chcpContext.sourceDirectory;
var executeDfd = Q.defer(),
funcs = [];
// Is called
funcs.push(function () {
return publicTunnel(assetPort);
});
// Not called
funcs.push(function (content_url) {
var dfd = Q.defer();
opts.content_url = content_url;
chcpContext.argv.content_url = content_url;
dfd.resolve();
return dfd.promise;
});
// Not called
funcs.push(function (debugOpts) {
if (debugOpts) {
opts.debug_url = debugOpts.debug_url;
opts.console_url = debugOpts.console_url;
}
return assetServer(opts);
});
// Not called
funcs.push(function (local_url) {
console.log('local_url', local_url);
opts.local_url = local_url;
return build(chcpContext);
});
// Not called
funcs.push(function () {
console.log('cordova-hcp local server available at: ' + opts.local_url);
console.log('cordova-hcp public server available at: ' + opts.content_url);
});
return funcs.reduce(Q.when, Q('initial'));
}
Although I'm not sure why...
I hope this helps in some way.
Thanks.
Feels good not to be alone in this one :)
Yep - I've been really scratching my head with this one, especially since
it has been working perfectly up until now!
Same for me. Always worked like a charm.
Could you explain to me how do you go about debugging the plugin ?
I am willing to give it a look, but I am not sure how to.
Actually, asking you, I realize it is probably within some .npm
folder. I'll have a look
I was just doing it by putting 'console.log()' statements into different parts of the scripts using notepad++, so on running 'cordova-hcp server' I can see where we get up to before the code gives up.
(Globally installed npm packages are stored in C:\Users\username\AppData\Roaming\npm\node_modules)
OK, I managed to identify that ngrok.connect()
never calls its callback.
So it must be an ngrok issue.
Here is the ngrok object as printed in the console :
ngrok { domain: null,
_events: {},
_maxListeners: 10,
setMaxListeners: [Function: setMaxListeners],
emit: [Function: emit],
addListener: [Function: addListener],
on: [Function: addListener],
once: [Function: once],
removeListener: [Function: removeListener],
removeAllListeners: [Function: removeAllListeners],
listeners: [Function: listeners],
connect: [Function: connect],
disconnect: [Function: disconnect] }
Running ngrok http 31284
works though
Interesting. I was wondering if it was something to do with ngrok and its graceful-fs 3.0.8 dependency:
+-- ngrok@0.1.99
`-- decompress-zip@0.1.0
+-- binary@0.3.0
| +-- buffers@0.1.1
| `-- chainsaw@0.1.0
| `-- traverse@0.3.9
+-- graceful-fs@3.0.8
+-- mkpath@0.1.0
+-- nopt@3.0.6
| `-- abbrev@1.0.7
+-- readable-stream@1.1.13
`-- touch@0.0.3
`-- nopt@1.0.10
Since I am getting the following warning on 'npm install -g cordova-hot-code-push-cli':
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3
and before will fail on newer node releases. Please update to
graceful-fs@^4.0.0 as soon as possible.
Hmmm. Hard to tell.
Still trying to figure out what is wrong with ngrok.connect()
but it seems the function is not even called
Here is what I just got as a response from ngrok
while keep on digging :
data Server failed to allocate tunnel: The ngrok 1.X service has been sunset.
Please upgrade to 2.0. More infromation is here: https://ngrok.com/sunset/1
I'll try to update and see
Yes. It took me some time to figure out how to update the dependencies of a NPM package, but this post on SO helped me out.
I'll push a pull-request and we should be OK.
Thanks for leading me on the way. I can now return to being productive :)
If you go to the package.json
file, and update the version of ngrok to "*"
, and then run npm update --save
, you will be fine again.
Great work! Your merge has sorted it.