Sublime couldn't find Node.js

☆樱花仙子☆ 提交于 2019-12-13 07:28:32

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/41193673/sublime-couldnt-find-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!