Alan P.
Alan P.

Reputation: 3123

Sublime couldn't find Node.js

I have had this very same problem happen with another Sublime Package - something isn't configured correctly on my Mac.

I installed CSSComb with npm install -g csscomb.

I installed the CssComb Sublime package using Sublime's "Package Installer".

I've restarted Sublime.

When I try to use CSSComb in Sublime, the console has the error:

Traceback (most recent call last):
File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 818, in run_
return self.run(edit)
File "/Users/alan/Library/Application Support/Sublime Text 3/Packages/CSScomb/CSScomb.py", line 35, in run
combed = self.comb(originalBuffer, syntax, config)
File "/Users/alan/Library/Application Support/Sublime Text 3/Packages/CSScomb/CSScomb.py", line 48, in comb
'$PATH by running `node -v` in your command-line.')
Exception: Couldn't find Node.js. Make sure it's in your $PATH by running `node -v` in your command-line.`

Running node -v outputs v7.0.0

Running echo $PATH outputs: /Users/alan/.nvm/versions/node/v7.0.0/bin:/Users/alan/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Within Sublime I have modified the path to node in the CSSComb configuration file:

"node-path" : "/Users/alan/.nvm/versions/node/v7.0.0/bin",

Still get the same error in Sublime console. Any help is appreciated.

Upvotes: 3

Views: 3694

Answers (1)

MattDMo
MattDMo

Reputation: 102852

From the README:

If node has been installed with NVM you need to make a symlink to node in /usr/local/bin. Using OS X, the binary path would typically be /Users/[your name]/.nvm/[node version]/bin/node.

Open terminal and run the following:

sudo ln -s /Users/alan/.nvm/versions/node/v7.0.0/bin/node /usr/local/bin/node

Then change the CSSComb settings file to:

"node-path": ":/usr/local/bin", // the colon ":" is important!

and see if that works.

Upvotes: 4

Related Questions