Sublime Text build: cannot find the file specified

2019-02-11 01:23发布

问题:

I've installed the CoffeeScript plugin via Package Control. When I try to build test.coffee it gives me this:

[Error 2] The system cannot find the file specified
[cmd:  [u'cake', u'sbuild']]
[dir:  C:\Users\Me\Documents\TestProject]
[path: C:\Users\Me\AppData\Roaming\npm\]
[Finished]

Here's the build in Sublime Text. I'm on Windows and everything CoffeeScript outside of ST2 works correctly.

{
    "cmd": ["cake", "sbuild"],
    "path": "C:\\Users\\Me\\AppData\\Roaming\\npm",
    "selector": "source.coffee",
    "working_dir": "$project_path"
}

The path gives the correct value. The cake script is there. So where's the problem?

回答1:

Thanks for the help guys. I've finally found the problem.

On Windows, instead of

"cmd": ["cake", "sbuild"]

it should be

"cmd": ["cake.cmd", "sbuild"]

Instead of modifying it just add:

"windows":
{
    "cmd": ["cake.cmd", "sbuild"]
}

That was subtle...



回答2:

Using Ms Window environment, you could try this:

{
    "windows":
    {
        "cmd": ["cake", "sbuild"],
        "selector": "source.coffee",
        "working_dir": "$project_path"
    }
}


回答3:

  1. Make sure cake is on your DOS path (I assume it is since you said that it works outside ST2)
  2. Remove the line with the path from your ST2 command. This line overwrites your DOS path and that would prevent ST2 from finding the executable.