73rhodes / Sublime-JSLint

JSLint for Sublime Text 2 and 3.
80 stars 14 forks source link

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

Closed scottstensland closed 8 years ago

scottstensland commented 9 years ago

ubuntu 14.04

I installed JSLint from sublime text 3 Package Control with a previous install of node which is reachable from $PATH however I do not have any related node modules installed via npm

getting :

[Errno 2] No such file or directory: 'node' [cmd: ['node', '/home/scott/.config/sublime-text-3/Packages/JSLint/linter.js', '--predef', "[...

so poking about found previous issue posting which solved my issue - I needed to add following to my user JSLint.sublime-settings :

{ "jslint": ["~/bin/nodejs/bin/node", "~/.config/sublime-text-3/Packages/JSLint/linter.js"] }

Evidently [Errno 2] suggests JSLint is NOT leveraging environment variable PATH to find node and instead throws up its hands saying : No such file or directory: 'node'

seems like this issue would be a quick fix

darrenderidder commented 9 years ago

Yeah but it has to work for Windows too.

coilysiren commented 9 years ago

I just had this same issue, was fixed by adding

{
"jslint": ["/usr/bin/nodejs",]
}

to JSLint.sublime-settings. Ubuntu's package control installs directly to /usr/bin/nodejs, I really don't see why I would have to manually add that path to the settings in order for jslint to work (ie.: why isn't it looking there already?).

73rhodes commented 9 years ago

It's been a while since I looked at this, but it's not as straightforward as it seems, iirc. Python spins up it's own little environment, and the different OS'es complicate matters. The readme file on the front page describes the problem and how to fix it, but if somebody can to contribute a better solution, patches are welcome!

73rhodes commented 9 years ago

BTW nodejs is just what Ubuntu calls it, which breaks tons of stuff, but they do it to avoid conflicting with another app that's already called node, which is used by some HAM Radio operators apparently. If you install from Ubuntu packages you run into this problem. I remember reading some threads about this on the mailing list and I think everybody agreed that if you're going to install node from the Ubuntu repos, you should set up a symlink to it, like this: sudo ln -s /usr/bin/nodejs /usr/bin/node

Personally I recommend people not to install node from the usual Linux repos though and just download it from nodejs.org. I'll leave the issue open and see if there's an easy workaround for the differently-named Ubuntu version...

coilysiren commented 9 years ago

Ah, and here I was thinking that someone just forgot to add to the search path >_>

itsmikeferrari commented 7 years ago

If you are using NVM to manage your node versions, you can enter this into your terminal which node and paste the result into your JSlint config file. Here's what my line looks like using nvm ,"jslint": ["~/.nvm/versions/node/v6.10.3/bin/node", "~/.config/sublime-text-3/Packages/JSLint/linter.js"]

I've tried adding node PATH and what not and couldn't get it to work, but this did. ;-)

vdsancheza commented 7 years ago

@itsmikeferrari Solution Works for me! Thanks.