Sublime-JSHint
Sublime-JSHint copied to clipboard
Node.js was not found in the default path, but I have specified it?
In ~/.config/sublime-text-3/Packages/JSHint Gutter/JSHint.sublime-settings
In console:
% which node /usr/local/bin/node
Then in settings:
"node_path": "/usr/local/bin/node",
But I still get the error and the process fails.
Using build 3047 on Linux (Lubuntu).
Any ideas?
What specifically does the error say?
Try setting the node_path
in JSHints user settings
, not default settings
.
Hello all!
I'm having troubles with node_path
too on Ubuntu, build 3047.
I've installed Node via aptitude install nodejs
, so I have the binary (v0.6.19) as /usr/bin/nodejs
. Package nodejs-legacy
also provides a symlink /usr/bin/node
→/usr/bin/nodejs
. Neither of these works with Sublime-JSHint.
jshint
itself is installed via nmp install jshint
. What could be the problem?
Ok, so apparently this happens because Ubuntu's stock Node.js is too old. The solution is to install a newer Node.js.
But, for the lazy ones like me, here's a patch that makes the plugin work on Ubuntu with Node.js installed from the repo:
diff --git i/scripts/run.js w/scripts/run.js
index 244ac7d..7259907 100644
--- i/scripts/run.js
+++ w/scripts/run.js
@@ -12,6 +12,7 @@
// Require path and file system utilities to load the jshint.js file.
var path = require("path");
var fs = require("fs");
+ fs.existsSync = path.existsSync;
// The source file to be linted, original source's path and some options.
var tempPath = argv[2] || "";
@ulidtko Great catch!
Anyone experiencing this problem, please pull and try again.
works for me. thanks.
Quick update - just did a quick tweak of JSHint.py to get the plugin to work on my box:
#node = "node" if exists_in_path("node") else settings.get("node_path") node = settings.get("node_path")
Seems that when it finds "node" on my path and sets node to "node", I get problems. Not sure why yet.
Here's some env info:
% echo $PATH /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
% which node /usr/local/bin/node
% node -v v0.10.15
/usr/local/bin % ls -la node -rwxrwxr-x 1 root root 11113912 Aug 15 17:43 node
Edit: Note that I installed node.js via source, not from apt.
I'm getting this error after upgrading to Yosemite - PluginUtils.exists_in_path("node") returns true, but PluginUtils.get_output(["node", ...]) fails with exit status 127 (even ["node", "-v"]) does that)
@victorporof - +1 for node_path error on Yosemite. Was previously fine on Mavericks install. Workaround here https://github.com/victorporof/Sublime-HTMLPrettify/issues/107#issuecomment-51530117 successfully hacks around the issue.
I'm facing the same issue on Yosemite. The workaround @booleanbetrayal mentions works for me as well. I had to hardcode node path in ~/Library/Application Support/Sublime Text 2/Packages/JSHint Gutter/JSHint.py
(search for def get_node_path(): method)
The same issue here. I am using Fedora 21 and the node is manually installed inside my machine.
I have update everything in my machine.
The which node
return usr/bin/node
.
Any helpful suggestion?
Wait.... amazing.. I just simply reinstall the plugin and try to set the path in file HTMLPrettify.sublime-settings like this:
"node_path": {
"windows": "C:/Program Files/nodejs/node.exe",
"linux": "/usr/bin/node",
"osx": "/usr/local/bin/node"
},
and it works :) :+1: really don't know the magic, but it makes sense cause my node path really is there.
@Anthonyeef, reinstalling did the trick. It's silly how simple it was!
Same problem, ubuntu 17.04. However, following did the work not sure if it is right one. which node returned the path ~/.nvm/versions/node/v9.1.0/bin/node. So replaced with the default path in the configuration and voila it seemed to work.
Wait.... amazing.. I just simply reinstall the plugin and try to set the path in file HTMLPrettify.sublime-settings like this:
"node_path": { "windows": "C:/Program Files/nodejs/node.exe", "linux": "/usr/bin/node", "osx": "/usr/local/bin/node" },
and it works :) +1 really don't know the magic, but it makes sense cause my node path really is there.
yup this now worked for me.