Open Michael-Stanford opened 8 years ago
Very interesting. This shouldn't be an issue with node 6, which from your file path looks like the version running.
Can you confirm that by manually editing
/Users/michael/.nvm/versions/node/v6.4.0/lib/node_modules/eslint/bin/eslint.js
and replacing the whole file with:
throw new Error('Node version: ' + process.version)
I'm curious if somehow the version of node running isn't actually node6 but is using files from that folder.
Wow! You nailed it!!!
Error:
/Users/michael/.nvm/versions/node/v6.4.0/lib/node_modules/
eslint/bin/eslint.js:2
throw new Error('Node version: ' + process.version)
^
Error: Node version: v0.10.33
at Object.
I am running n (https://github.com/tj/n) to manage my Node versions. I had an old version of node in /usr/local/bin, which was not showing up with
$ which node /Users/michael/.nvm/versions/node/v6.4.0/bin/node
But now that I have deleted it, ESLint Formatter can't find Node at all:
Couldn't find Node.js. Make sure it's in your $PATH by running
node -v
in your command-line.
$ node -v v6.4.0
It looks as though n works by putting the right path at the beginning of the $PATH environment variable: $echo $PATH /Users/michael/.nvm/versions/node/v6.4.0/bin:...
So it is in my $PATH, but still not being found by ESLint-Formatter
So I put an alias in /usr/local/bin, and now everything is working. Please let me know if you are able to fix it so it really uses the $PATH so I can get rid of the alias.
By the way - it may be related - it also wasn't finding the .eslintrc.js file in the ancestor-path of the file being edited, so I had to hard-wire a "config_path" in the sublime-settings file.
Best regards - thank you so much for your help, and thanks also for giving your excellent code to the community.
Michael.
On Thu, Oct 20, 2016 at 12:28 PM, Eli White notifications@github.com wrote:
Very interesting. This shouldn't be an issue with node 6, which from your file path looks like the version running.
Can you confirm that by manually editing
/Users/michael/.nvm/versions/node/v6.4.0/lib/node_modules/eslint/bin/eslint.js
and replacing the whole file with:
throw new Error('Node version: ' + process.version)
I'm curious if somehow the version of node running isn't actually node6 but is using files from that folder.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TheSavior/ESLint-Formatter/issues/26#issuecomment-255172593, or mute the thread https://github.com/notifications/unsubscribe-auth/AB8vVCP9vYygQa5reflWpGKWPScD_Dgzks5q16S2gaJpZM4KcTEC .
Michael Stanford +1 (214) 233-5303
Having the same issue with NVM.
Ideally we shouldn't have to statically specify our eslint path if it is already in our shell's PATH.
❯ which eslint
/Users/timkelty/.nvm/versions/node/v7.4.0/bin/eslint
I don't want to have to change the sublime setting anytime i switch node versions. (this is how https://github.com/roadhump/SublimeLinter-eslint seems to do it)
I think using which
like SublimeLinter does would be a great addition to this plugin. I'd happily accept a PR.
sounds good, I'll put a PR on my todo list!
Probably user error, but I installed ESLint-Formatter with Sublime Package Control and still get an odd error when I press cmd-shift-H:
When I type
at the bash prompt it works OK.
But when I run eslint-formatter in Sublime Text 3 it pops up a Sublime-logoed window saying: