tern_for_vim (ternjs) returns 403 access denied

235 Views Asked by At

Trying to get JavaScript completion working in MacVim, using YouCompleteMe + TernJS.

I've followed the install instructions for both plugins (I use Vundle to manage vim plugins), which included running ./install.sh script inside the YCM plugin folder, and npm install inside the TernJS plugin folder. Installation of both appears to have completed successfully.

However I'm not getting any JS completions as I type; and if I try to manually trigger something in TernJS (eg. :TernDef), I get a HTML error page back from the local TernJS server, indicating a 403 Access Denied error.

If I launch MacVim with sudo (eg. sudo mvim); everything seems to work fine.

Also, without sudo, I can manually post a JSON document to the TernJS server (outside of vim) and get a valid response back.

I'm running MacVim 7.4.71 (installed via Homebrew; compiled with python support ), and node 0.10.21 (also installed via Homebrew).

Any ideas on what I could check, so that I can have TernJS completions without needing to use sudo to launch MacVim?

1

There are 1 best solutions below

0
On

Figured it out.

My shell profile was setting the $http_proxy env variable so the requests from MacVim to the local TernJS server were trying to go out through a proxy server.

Fixed by adding export no_proxy=localhost to my shell profile, so that requests to http://localhost don't use a proxy.