polygonplanet/sublime-text-eslint

ESLint error when run in ST3: Can't find node

Closed this issue · 1 comments

Hello,

I'm running Linux Ubuntu 16.04 as a 'headless' virtual machine (i.e. it can only be accessed through a terminal, but the files in the VM can be accessed from the host machine with (e.g.) Sublime Text 3). It comes pre-installed with node as part of a course I'm taking. I believe I followed your installation instructions to the letter. Specifically:

Typing "which node" into the terminal results in:
/home/vagrant/.nvm/versions/node/v6.9.5/bin/node

Similarly, typing "which npm" into the terminal yields:
/home/vagrant/.nvm/versions/node/v6.9.5/bin/npm.

So both of these seem to be installed as was required. In case its useful, I found their versions to be:

node -v
v6.9.5
npm -v
v3.10.10

Next, after typing in "npm install -g eslint" into the terminal, everything seemed to install correctly. Then I opened the command pallet in Sublime Text 3 (ST3), and installed ESLint (note that I am using the unregistered version of ST3).

Now as I understand it, this is installed globally, so it doesn't matter where my javascript files are. So I opened a random javascript file I had in ST3 (specifically: "/home/vagrant/assignments/chess.js"). But when I right-clicked to open the context menu, and selected ESLint, a black console message appeared at the bottom of the screen with the following output:

[Errno 2] No such file or directory: 'node'

So it seems like it can't find node from my environmental $PATH variable. So then I thought I would manually add it in. I went to:
Preferences / Package Settings / ESLint / Settings - User.

In this settings file, I added the following (the rest of the file is empty). As you may recall, this duplicates the output of my "which node" entry into the terminal above, except I am selecting the directory and not the executable:

{
"node_path": "/home/vagrant/.nvm/versions/node/v6.9.5/bin",
}

I saved everything, closed ST3, and then re-opened my chess.js file in ST3. I then opened the context menu, and selected ESLint, but the error popped up again. I tried running ESLint from the command pallette, and the same error was still there.

I know node is installed and works, because I can actually use node in the terminal. For instance, in the assignments directory I quoted above, typing "node chess.js" will execute the program in the terminal (where it outputs a crude image of a chessboard to the terminal).

I even tried changing "node_path" to point to the executable (.../bin/node), but the same errors occurred. Can you help me figure out if I'm doing anything wrong, or is this a bug? Please bear in mind that I am new to linux.

I think I just realized why it probably isn't working. I totally forgot that my host machine won't see the node files in my guest machine...after working so long in my VM I started to think it WAS my computer. This probably explains why it failed. I'll just close this.