Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run on command line in Windows/Cygwin #309

Open
davidmichaelkarr opened this issue Mar 26, 2014 · 5 comments
Open

Can't run on command line in Windows/Cygwin #309

davidmichaelkarr opened this issue Mar 26, 2014 · 5 comments

Comments

@davidmichaelkarr
Copy link

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. (C:\Users\dk068x\git\tern\lib\infer.js:22:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

at Function.Module._load (module.js:312:12)

@marijnh
Copy link
Member

marijnh commented Mar 26, 2014

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.

@davidmichaelkarr
Copy link
Author

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.

@marijnh
Copy link
Member

marijnh commented Mar 28, 2014

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.

@silverwind
Copy link

@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.

@samzeng
Copy link

samzeng commented May 8, 2017

try this solution

npm/npm#2465 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants