tststs / atom-ternjs

JavaScript code intelligence for atom with tern.js and autocomplete-plus
MIT License
627 stars 76 forks source link

Wrong path construction for tern executable #160

Open philippwinter opened 8 years ago

philippwinter commented 8 years ago

Hello,

I am writing a node application and wanted to use atom-ternjs to get type completion. Although, after installing and configuring my project I get the following error:

'C:\Users\winterp.atom\packages\atom-ternjs\node_modules.bin\tern' is not recognized as an internal or external command, operable program or batch file.'

Note the missing backslashes after user as well as node_modules

This is my current .tern-project:

{
  "ecmaVersion": 6,
  "libs": [],
  "loadEagerly": [
    "app/**/*.js"
  ],
  "plugins": {
    "node": {}
    "node-express": {}
  }
}

Note that there is not even a file tern inside the corrected path (C:\Users\winterp\.atom\packages\atom-ternjs\node_modules\.bin).

winterp@WINTERP3 MINGW64 ~/.atom/packages/atom-ternjs/node_modules/.bin
$ ls
acorn*  acorn.cmd  tern-lint*  tern-lint.cmd  tsc*  tsc.cmd

I'm currently working on a 64bit install of Windows 8.1. Git and node are installed as well as on the path.

winterp@WINTERP3 MINGW64 ~
$ apm --version
apm  1.4.0
npm  2.13.3
node 0.10.40
python 2.7.10
git 2.6.2.windows.1
visual studio

With kind regards

tststs commented 8 years ago

Could you please update to 0.9.0 and try again. Maybe this will solve the issue but i'm not sure. Because we are talking about the backslash... is the username on the current system user?

philippwinter commented 8 years ago

Well, I updated to 0.9.0 (since it is not in the official repositories yet, I had to manually run apm install atom-ternjs@0.9.0) and the error has been replaced with a new one..

Bad JSON in C:\Users\winterp\needle\server.tern-project
Unexpected string

Followed by:

Error parsing .tern-project. Please check if it is a valid JSON file.

As you see, the user name is winterp (and would've been in the initial post as well if I didn't edit it). Another time, one backslash in front of the file name is missing.

As far as I can see from here, if a file or directory starts with a . the necessary backslash is omitted from the plugin.

Greetings

tststs commented 8 years ago

Please try 0.8.1. I couldn't reproduce the issue on Windows 8.1 with 0.8.1. If the issue still exists you may post the structure (folders/files) of the project so i can reproduce the problem.

Greetings

philippwinter commented 8 years ago

Well, after switching to 0.8.1 and still having an error, I double checked the config file and found it included an typo. After the specification of the node plugin a , is missing which caused the program to fail.

In effect, using the latest version the correct error is thrown (Bad JSON), although the file path is not properly outputted.

Therefore, I would propose to close this issue and open a new one regarding this problematic scenario.