0

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!

4

1 回答 1

4

确保grunt在您的pathwith sublime 中(它可能与您的终端路径不同)。查找路径类型:npm bin -g. 您可以在 sublime-build 配置中设置路径:

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

只是一个挑剔,将 设置working_dir为基本项目路径。并不重要,因为 grunt 会在到达 gruntfile 之前找到它,但这会稍微快一点地找到 gruntfile ;)

于 2012-12-04T18:21:56.893 回答