Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Build system in Sublime Text 2

I'm struggling to successfully build a HTML build system in Sublime Text 2. I am running Windows 7. This is the code for my build system:

{
    "cmd": ["open", "-a", "Google Chrome", "$file"]
}

This is the error I recieve when I try and build a html file:

[WinError 2] The system cannot find the file specified
[cmd: ['open', '-a', 'Google Chrome', 'C:\\Users\\Soham\\Desktop\\hello.html']]
[dir: C:\Users\Soham\Desktop]
[path: C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem]
[Finished]

I have no idea why this error is ocurring and have searched the web for an explanation.

Any help will be much appreciated!

Thanks in advance!

like image 796
Hummus Avatar asked Jul 14 '13 19:07

Hummus


2 Answers

The open command is only available on OSX systems. You have two options - you can use Sublime's built-in "Open in Browser" functionality by right-clicking in any open HTML file and selecting Open in Browser, or you can modify your build system to just point to the correct location of chrome.exe:

"cmd": [ "C:\\Users\\YourUserName\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe", "$file"]

replacing YourUserName with the correct value, and ensuring that this actually is the location of chrome.exe on your system.

like image 92
MattDMo Avatar answered Oct 24 '22 01:10

MattDMo


If you are using Chrome with Windows 7, you could run successfully the following:

{
   "cmd": ["C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe", "$file"]
}
like image 1
Diego Santos Avatar answered Oct 24 '22 03:10

Diego Santos