tern
tern copied to clipboard
Can't run on command line in Windows/Cygwin
I'd just like to experiment with Tern, and AngularJS customizations. I'm on Win7/Cygwin. I put the "tern/bin" directory in my path, then ran "tern" from a new shell.
I get the following:
module.js:340 throw err; ^ Error: Cannot find module 'C:\c\users\myuid\git\tern\bin\tern' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16)
at node.js:902:3
That translation to "C:\c\users..." is wrong.
Note that if I instead try a more complex command line like this:
node "$(cygpath -m ~/git/tern/bin/tern)"
(If you don't know, "cygpath -m" translates a Cygwin path to a form like "C:/users/...".)
When I run this, I instead get the following:
module.js:340
throw err;
^
Error: Cannot find module 'acorn/acorn'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at exports.toString (C:\Users\dk068x\git\tern\lib\infer.js:17:25)
at Object.
at Function.Module._load (module.js:312:12)
I have no recent experience with cygwin, but this seems like a fundamental misunderstanding between that environment and node. The failure is in basic module loading, which is not Tern-specific at all. I assume you get the same issues when running other node scripts that require other modules. Did you try? If so, I suspect reporting this to the node (or even cygwin) projects is more productive.
I use this same Node installation to run Karma for javascript unit tests, both on the command line, and from a Maven build script, both from a Cygwin shell.
Interesting. Still, the module is there, obviously (the file exists, and is a JavaScript program), so something is going wrong when resolving the path to the script — and there Tern doesn't do anything non-obvious... it just calls require with a relative path.
@davidmichaelkarr For node scripts on Cygwin, I exclusively call them like cmd /c tern. Elimininates most issues, and I'd advice to alias it if it works for you.
try this solution
https://github.com/npm/npm/issues/2465#issuecomment-6157373