2

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.

Alan P.
  • 2,898
  • 6
  • 28
  • 52

1 Answers1

3

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.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • Suppose you already had node installed under `/usr/local/bin`. What might you try in that scenario? – kendfss Nov 11 '21 at 22:38
  • @kendfss then you don't need to run the `sudo ln ...` command, just edit the CSSComb settings like I showed. – MattDMo Nov 12 '21 at 14:30
  • Thanks, it was a different plugin without that particular option but in the end I just put `os.environ["PATH"] += os.pathsep + "/usr/local/bin"` near the top of every file that used either `os.environ` or `os.getenv`. They reference the same underlying dictionary, so there was no need to be too fussy. – kendfss Nov 14 '21 at 00:32