tisAliG
tisAliG

Reputation: 31

Sublime text cannot find Node.js. How do I help Sublime find Node properly?

The story:

I had installed n about a month back while playing around with creating an Eslint config on my Mac, which was when Sublime Text started giving me problems, specifically with Eslint via Sublime linter. I had a bit of a break so I didn't attempt to fix the issue until last week, which was when I uninstalled n and installed nvm thinking that the issue was n. I then started getting the cannot find node error when I save any file in Sublime. Since then I had uninstalled nvm and node.js in hopes to start from scratch and fix the issue. I re-installed nvm and found this post, stating the issues that nvm creates with changing the path for node.js on my machine. I tried the fix that was given, which was to create a link between the nvm path to node and usr/local/bin/node but that didn't work either. I have since uninstalled nvm in hopes that just having good old node.js installed by itself to do the trick. Still no luck.

The error:

Couldn't find Node.js. Make sure it's in your $PATH by running node -v in your command-line.

Which is an alert from the Sublime app that only happens when I try to save a file.

Other things I have tried:

Updating my .bash_profile to make sure my PATH was correct. Updating my .bash_exports to make sure my PATH and NODE_PATH are correct. Updated my machine to macOS Sierra.

In iTerm:

node -v returns v11.3.0

which node returns /usr/local/bin/node

echo $PATH returns /usr/local/bin:/usr/local/share/npm/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin/node

echo $NODE_PATH returns /usr/local/bin/node

Note: I don't want to uninstall Sublime as this is on my work machine and it's a pain in the butt to deal with IT with the sublime license.

Upvotes: 2

Views: 961

Answers (1)

tisAliG
tisAliG

Reputation: 31

After un-installing everything and re-installing everything, nothing worked. I gave up on n or nvm for the time being, and completely un-installed them. I even uninstalled Sublime and reinstalled it. The last thing I did was un-install and re-install sublimelinter eslint, which seemed to fix the issue. I'm not sure if that was really the fix, because I had already done that multiple times. The issue is resolved for the time being. I will update if the issue resurfaces.

Upvotes: 1

Related Questions