ternjs / tern_for_vim

Tern plugin for Vim
MIT License
1.83k stars 100 forks source link

Tern Server fails to start #88

Closed yoaquim closed 8 years ago

yoaquim commented 9 years ago

Whenever I try and run a tern command, I get this:

Failed to start server:
module.js:338
    throw err;
          ^
Error: Cannot find module '/Users/yoaquim.cintron/.vim/bundle/tern_for_vim/node_modules/tern/bin/tern'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Seldom will the server start correctly.

The module is there, I'm assuming, but maybe there's an issue when loading it?

Any workarounds/fixes to this?

marijnh commented 9 years ago

If that absolute path is correct, I can see no reason why this would fail occasionally but not always. If you start node from the command line, and give it that path, does it work? Is there anything weird or non-deterministic about your file system (network mounts, etc)?

yoaquim commented 9 years ago

Not really. I installed this plugin by cloning via pathogen, and it's set up as a git submodule, since I back up my vim stuff to my own, personal repo. Running node [path] doesn't return an error; I get "Listening in on port 60599".

hatelove85911 commented 9 years ago

+1 same here.

youran0715 commented 9 years ago

Ubuntu "node.js" command is "nodejs" not "node". It works by modify autolad/tern.vim line 15 from let g:tern#command = ["node", expand(':h') . '/../node_modules/tern/bin/tern', '--no-port-file'] to let g:tern#command = ["nodejs", expand(':h') . '/../node_modules/tern/bin/tern', '--no-port-file']. Can you add a option to set node.js command? eg: let tern_nodejs_cmd = "nodejs"

irakli-lekishvili commented 9 years ago

I have same issue. Installed with Vundle

irakli-lekishvili commented 9 years ago

Solved problem with sudo npm install tern

davidjb commented 9 years ago

I installed this plugin via Vundle, and did a local install via npm install inside this plugin's directory (eg ~/.vim/bundle/tern_for_vim). I can run the server standalone if I set with the NODE_PATH environment variable in the shell before opening vim to point it at ~/.vim/bundle/tern_for_vim/node_modules. Need to look into this more for a better solution.

collegeimprovements commented 9 years ago

+1 same problem occurs on my mac also.

twxia commented 9 years ago

same problem here. Just need to go to ~/.vim/bundle/tern_for_vim npm install myself

mydearxym commented 9 years ago

+1 same issue

collegeimprovements commented 9 years ago

I used neobundle and installed tern via sudo npm and still the issue persists.

zmackie commented 9 years ago

@twxia Was having this problem, but your solution fixed it. :tada: (although in my case the path was /.vim/plugged/tern_for_vim).

marijnh commented 9 years ago

(The fact that you have to npm install in the bundle's directory is mentioned in the readme.)

zmackie commented 9 years ago

😳 yeah it's is. And I realized that things broke because I did a reinstall of all my plugins without running the install script. Shame on me.

ghost commented 8 years ago

Close?

marijnh commented 8 years ago

Let's.