Sublime Text 2在尝试运行Grunt构建系统时出现PATH错误

时间:2013-03-12 01:23:31

标签: ruby macos node.js sublimetext2 gruntjs

我为Sublime Text 2创建了这个构建系统来运行我的Grunt项目:

{

"cmd": ["grunt"] ,  
"selector": ["source.js", "source.less", "source.json"] ,
"working_dir": "${project_path}/MyProject" ,
"path": "/Users/me/.nvm/v0.10.0/bin",
"shell": true

}

每次我尝试构建时,都会收到此错误:

Warning: You need to have Ruby and Sass installed and in your PATH for
this task to work. More info:

尽管我已经安装了RubySass,但两者都可以在终端中使用。另外,我已经尝试了"echo $PATH",看起来没问题......

  

/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/me/.venvburrito/bin:/Users/me/.nvm/v0.8.22/bin:/opt/local/bin:/选择/ local / sbin中:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/me/.rvm/gems/ruby-2.0。 0-P0 / bin中:/Users/me/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/me/.rvm/rubies/ruby-2.0.0-p0/bin:/用户/me/.rvm/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin: / sbin目录:在/ usr / local / bin中:在/ usr / X11 / bin中:在/ usr /本地/ GIT中/ bin中

为什么sublime似乎无法访问我的环境变量?

2 个答案:

答案 0 :(得分:1)

"path"属性将覆盖现有路径。您需要删除该属性或手动添加Sass二进制文件的路径。您可以使用which sass找到它。

示例:

"path": "/usr/local/bin/:/Users/me/.nvm/v0.10.0/bin"

答案 1 :(得分:0)

搞定了。我不得不将其添加到“path”属性中:

"/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/me/.rvm/rubies/ruby-2.0.0-p0/bin/ruby:/Users/me/.rvm/gems/ruby-2.0.0-p0/bin/sass:/Users/me/.nvm/v0.10.0/bin"

显然你必须用你自己的名字替换“我”。感谢Sindre Sorhus指出我正确的方向。