Closed mrtnbroder closed 10 years ago
working fine for me with a manual install. on OSX
Not for me. Maybe because I symlinked my Packages Folder to Dropbox.
Not working for me either using latest ST3 build on Windows 8 x64 trying to install it via package manager.
any updates on this? I find this plugin pretty useful.
Well, um, did you try not symlinking to dropbox, but doing a manual install checkout and npm install
somewhere local?
Had some problems myself using ST3 on OS X
, partly because there is no real "success" indicator (other then tern working of course), e.g. no dedicated package settings file showing up in the menu that reassures you that the plugin is installed and working. There are basically two ways I got it working (I prefer the second one):
Use Package Control and a globally installed tern
npm install tern -g
tern_for_sublime
package using Package Controltern_command
to ["node", "/usr/local/bin/tern"]
in your ST3 global user settings.tern-port
file in the folder where your JS files are located and put only the port number in it (I am pretty sure that this is supposed to be handled by tern_for_sublime
, probably a permission issue on my side)Clone tern manually into your Packages
folder (preferred)
tern_for_sublime
package via Package Control as well as the tern_command
setting, the defaults will workgit clone git://github.com/marijnh/tern_for_sublime.git
into the ST3 Packages folder (OS X: ~/Library/Application Support/Sublime Text 3/Packages
)cd tern_for_sublime
and npm install
the tern dependency in place (this is the default location of tern_command
).tern-port
file should appear in the folder as soon as you are using tern (you can prevent this by setting "tern_arguments": ["--no-port-file"]
)What happened with the automatic installation that the plugin tries to do the first time it starts without being able to find Tern? It simply npm install
s Tern in your packages folder, much like your second set of instructions.
Didn't work for me, clicking „Yes, install“ gave no feedback and some time later on the same window appeared. However, I did not look into that further but tried to configure it by hand. Is the automatic installation supposed to work with the default tern_command
setting, so you can omit that setting completely? Just wondering, as installing the package via Package Control doesn't create a tern_for_sublime
folder in the Packages folder but instead install the package to Installed Packages
.
Edit: Tried it out and no folder was created inside Packages
(got node
and npm
installed and available). After a restart, the dialog was shown again.
The Python code uses os.path.abspath(os.path.dirname(__file__))
to figure out where it's installed, so I don't think the difference between Packages
and Installed Packages
should matter.
if there is a file in "installed packages" called tern something I would try deleting it. I've done that with other plugins with success. I think I reinstalled the plugins afterwards or something too but yea..
Automatic installation doesn't work for me either (though I gave up trying due to final exam period)
There is nothing named in the "installed packages" that's either called or contains tern
If you install via Package Control, there should be a file called tern_for_sublime.sublime-package
. Those are ZIP archives, you can (rename and) extract them. Could very well be that the automatic installation of tern fails in this situation.
Package control zips the package? Well, yes, that'll obviously cause trying to run npm install
in the package directory to fail. Is there a way to turn that behavior off?
It seems you can drop a .no-sublime-package
file in your project:
That's useful. Added in attached commit.
npm install
still doesn't run after installing the package that includes .no-sublime-package
(Windows 8 x64, npm is in PATH)
For me the installation via Package Control including npm installing tern
works as expected now (I'm on OS X though, could be a Windows specific bug).
tried manually\auto installing - failed on win7/st2. even when all the files are in the package and npm installs tern - sublime just doesn't want to complete anything.
Any python error messages in the ctrl-backtick console?
i did a lot of steps to make it work: 1) manually insall via git & npm install 2) changed the folder name 3) auto install via package manager 4) copy all files from the manual install to the new folder 4) run the cmd file that runs the port
--> i got the autocompletion to work. it was a lot slower that TernJS and didn't seem to contribute more --> uninstalled it.
what i really wanted is adobe's brackets editor tern implementation. it is flawless. why doesn't tern complete $("x"). expressions?
why doesn't tern complete $("x").
It does, if you tell it to load the jQuery definitions.
Anyway, yes, the Sublime Text plugin needs an experienced Sublime Text user to properly maintain and polish it. I put it out there as a rough draft, but I use Emacs, so I have neither the expertise nor the personal involvement to really perfect this.
In my console I’m getting the following error:
Traceback (most recent call last):
File "/opt/homebrew-cask/Caskroom/sublime-text3/3047/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 157, in on_api_ready
m.plugin_loaded()
File "/Users/Oliver/Library/Application Support/Sublime Text 3/Packages/tern_for_sublime/tern.py", line 495, in plugin_loaded
subprocess.check_output(["npm", "install"], cwd=plugin_dir)
File "X/subprocess.py", line 571, in check_output
File "X/subprocess.py", line 818, in __init__
File "X/subprocess.py", line 1416, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: 'npm'
npm is installed.
But is it also in your the $PATH that sublime text sees?
It's in my $PATH, but I'm not sure if Sublime uses the $PATH defined in my shell setup.
❯ which npm
/usr/local/bin/npm
If you go to the console (ctrl-backtick) in ST and run this, you should be able to check:
import os
os.getenv("PATH")
Ended up needing https://github.com/int3h/SublimeFixMacPath. Thanks.
Oh, that's good to know. I'll keep it in mind next time someone has this problem.
I have the same problem with Sublime text 3 and windows 7 x64
@mladenuzelac add (adjusting path) "tern_command":["node", "C:/Users/blabla/AppData/Roaming/npm/node_modules/tern/bin/tern", "--no-port-file"]
to your Preferences -> Settings - User file.
Is it worth adding a step for Mac users to install https://github.com/int3h/SublimeFixMacPath
in the README? It's just caught me out again, reinstalling.
Attached patch adds a short note about this.
:+1: SublimeFixMacPath fixes it for me. Cheers
Still having trouble making autocomplete to work (I'm using Linux Mint 17.2 Cinnamon and ST3 Build 3114).
I tried installing it both manually and via the Package Manager. I added "auto_complete_triggers": [ {"selector": "text.html", "characters": "<"}, {"selector": "source.js", "characters": "."} ]
to my Preferences file. I set:
"tern_argument_hints",
"tern_argument_completion",
"auto_complete"
to true
. I followed @wtw's advice by adding a .tern-port
file all to no avail.
I also cleaned npm's cache and then updated both npm and minimatch.
Edit: Autocompletion wasn't working for me because I was missing the .tern-config
file in my home directory. Here are contents of the file:
{
"libs": ["browser", "ecmascript"]
}
Installed this via Packages Control ( Also tried manually ) but it always says "It appears Tern has not been installed...".
I think it's because how ST3 handles packages now.