简体   繁体   中英

Sublime Text 2 OSX Grunt build system woe

I'm trying to use Sublime Text 2s build system to run a Grunt task. I have no issues using Grunt within Terminal. My setup works well on my Windows machine but my Mac hates it.

This is my .sublime-build configuration:

{
  "selector": "grunt.js",
  "working_dir": "${project_path}/js",
  "windows": {
    …
  },
  "osx": {
    "cmd": ["grunt", "--no-color"]
  }
}

And the output returned is:

[Errno 2] No such file or directory

The working directory and path returned are correct. My software versions are:

  • OSX 10.8.2
  • Node 0.8.9
  • NPM 1.1.68
  • Grunt 0.3.17
  • Sublime Text 2.0.1

Please save me any more frustrated Googling!

Make sure grunt is in your path with sublime (it can be different then your terminal path). To find the path type: npm bin -g . You can set the path in your sublime-build config:

{
  "selector": "grunt.js",
  "working_dir": "${project_path}",
  "path": "/usr/local/bin",
  "osx": {
    "cmd": ["grunt", "--no-color"]
  }
}

Just a nitpick, set the working_dir to the base project path. Not important as grunt will find up until it reaches a gruntfile but that will find the gruntfile slightly faster ;)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM