[Emacs] Request failed: ((error http 400) . TypeError: str.charCodeAt is not a function)


Trying to learn node, I’ve cloned this https://github.com/ternjs/tern . I am testing this file: https://github.com/ternjs/tern/blob/master/bin/tern

by opening and running M-x tern-mode

It appears autocomplete is working, this issue is with jump to definition.

I assume this .tern-project is valid. I try M-. on, for example, the below snippet. Every place I do this throws the error in this post title. What configuration is needed to get this to work, I have performed the configuration detailed here: http://ternjs.net/doc/manual.html#emacs . Thanks

var httpServer = require("http").createServer(function(req, resp) {
  shutdown = setTimeout(doShutdown, maxIdleTime);

  var target = url.parse(req.url, true);
  if (target.pathname == "/ping") return respondSimple(resp, 200, "pong");
  if (target.pathname != "/") return respondSimple(resp, 404, "No service at " + target.pathname);

  if (req.method == "POST") {
    var body = "";
    req.on("data", function (data) { body += data; });
    req.on("end", function() { respond(resp, body); });
  } else if (req.method == "GET") {
    if (target.query.doc) respond(resp, target.query.doc);
    else respondSimple(resp, 400, "Missing query document");


Strange. Jump-to-definition in Emacs works for me in that file. Could you try starting the server manually, with --verbose, and then seeing if it outputs anything useful?

$ cd /path/to/tern
$ ./bin/tern --verbose

And now go to emacs and try completion again. It should automatically pick up the running server and you’ll see output in the console. If it crashes, there should be a stacktrace. If that works, could you paste all the output here?


ran with emacs -q and appears to work, issue is with my config


hmm actually runs in terminal emacs with my existing config, I’m assuming the GUI supported?


cloned latest version and works, guess this can be closed