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!
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.
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"]
}
Related
I am trying to set a portable development Environment:
VS Code - Portable mode
git-bash - portable
Node.js - portable
VS Code throws Error: The terminal shell path "......\vsCode\git\bin\bash.exe" does not exist
I have C:......\Documents\Storage\vsCode\data\user-data\User\settings.json
and C:......\Documents\Storage\vsCode\git\bin\bash.exe
settings.json:
{
// Git Bash
"terminal.integrated.shell.windows": "..\\..\\..\\vsCode\\git\\bin \\bash.exe"
}
It works in CMD:
C:\.........>cd C:\...........\Documents\Storage\vsCode\data\user-data\User
C:\.......\Documents\Storage\vsCode\data\user-data\User>cd ..\..\..\git\bin\
C:\.......\Documents\Storage\vsCode\git\bin>
Can you guide me how to deal with relative path in VS Code without setting global variables in the operating system. I will need to do the same thing with Node.
Sorry for the messy post but I am fairly new to posting here.
You can follow below link :
https://code.visualstudio.com/docs/editor/integrated-terminal
You need to edit the terminal integrated path in settings.json file to which ever thing you want it to compile it with
See the URL in the screenshot to find the location for settings.json file at my end:
I searched for "shell path" in the VS Code settings and noticed that the path was wrong
(Program Files instead of Program Files (x86))
I had to change it to
"terminal.integrated.shell.windows": "C:\\Program Files (x86)\\Git\\bin\\bash.exe",
#Rhatalin thank you for the suggestion. I had the same issue on Windows 10. After updating below setting in settings.json (File -> Preferences -> Settings search for shell and choose Terminal-Integrated-Automation Shell: Windows -> Edit in settings.json) the issue was gone.
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
After a Windows update, I got the same error. I had to add escape \ characters to each backslash in the path to get it to work again. (check your path to make sure each single \ is double \)
This works: "C:\Program Files\Git\bin\bash.exe"
This does not work: "C:\Program Files\Git\bin\bash.exe"
I wrote my HelloWorld.cs using MonoDevelop, and Gtk# 2.0. It runs fine in the debugger, and it builds HelloWorld.exe. When I run from a terminal window "mono ./HelloWorld.exe" then the program runs as expected so I know it is coded as expected. However when I attempt to run it by double clicking on it from Files (Linux version of Windows Explorer) it opens Archive Manager with an error "An error occurred while loading the archive".
I am using Ubuntu 18.04.02 LTS, if that makes a difference.
I tried creating a link "ln -s ./HelloWorld.exe ./meow", and double clicked on meow, however that also opens Archive Manager with the same error.
I don't want my end product to require the user to open a Terminal window to run my program, what do I do so that the user can double click on my program from Files to run?
EDIT: [18FEB2019]
Thanks Some programmer dude, I like the bundle idea as I may port this project to a different flavor of linux and I hope this gives me a path to get there.
However, I got error:
Failure to load i18n assemblies, the following directories were searched for the assemblies:
Path: .
In Custom mode, you need to provide the directory to lookup assemblies from using -L
ERROR: Couldn't load one or more of the i18n assemblies: Failed to load I18N.dll
I searched and found
https://www.mono-project.com/docs/tools+libraries/tools/mkbundle/
I followed those directions and got stuck at this part
mkbundle -o CacheServer --cross mono-5.8.0-ubuntu-16.04-x64 CacheServer.exe --machine-config /etc/mono/4.5/machine.config
my error is
ERROR: Unable to load assembly `gtk-sharp' referenced by `/home/amccombs/Projects/HelloWorld/HelloWorld/bin/Debug/HelloWorld.exe'
I tried
mkbundle --fetch-target gtk-sharp
with result
Failure to download the specified runtime from https://download.mono-project.com/runtimes/raw/gtk-sharp
I then tried
sudo apt-get install gtk-sharp
with result
E: Unable to locate package gtk-sharp
Files is detecting the .exe extension as an archive, and therefore it opens it with File Roller or similar.
Just right-click the file HelloWorld.exe and select "Open With Other Application", click on "Find New Applications", and then type "mono" and press ENTER. The app will open.
Another possibility is to create a .desktopfile, and place it under ~/.local/share/applications, with this contents:
[Desktop Entry]
Exec=mono %F
MimeType=application/x-ms-dos-executable;
Name=mono
NoDisplay=true
Type=Application
MKBundle creates a native app from a mono application. The downside is that you have to compile both the app and all its dependencies, which can be tricky. In any case, the package you are looking for is gtk-sharp2.
An alternative to MKBundle is to include a text file, say HelloWorld.sh with the contents:
mono HelloWorld.exe
And then make it executable with:
chmod +x HelloWorld.sh
You can then pack both files together (use a .tar.gz target, which preserves attributes such as the executable one), and probably with a README file explaining to double-click HelloWorld.sh.
Or maybe you can pack the .exe with the .desktop file, and explain in the README file where it must be placed.
There are tons of possibilities.
Why is this Sublime Text Grunt Build failing in Windows 7?
{
"cmd": ["grunt.cmd", "--no-color"],
"path": "C:\\Users\\USER\\AppData\\Roaming\\npm;C:\\Program/ Files\\nodejs",
"working_dir": "${project_path}"
}
Console says:
'node' is not recognized as an internal or external command, operable program or batch file.
[Finished in 0.1s with exit code 1]
Try the following first:
{
"cmd": ["grunt.cmd", "--no-color"],
"path": "C:/Users/USER/AppData/Roaming/npm;C:/Program\ Files/nodejs",
"working_dir": "${project_path}"
}
If that doesn't work, try removing the \ character between Program and Files. You don't need the "selector" argument at all, as that is used to specify the scope for the build system. ["Gruntfile.js"] is not a valid scope.
As an alternative option, check out the Grunt plugin available via Package Control. I haven't used it myself, but it looks quite useful. It parses your Gruntfile.(js|coffee) file and adds the available tasks to the Command Palette, among other things. It directly reads your PATH variable, so as long as your node and npm directories are there, it should work quite well.
I'm trying to do a custom build for Sublime 3 so that it opens chromium and the .html document that I'm working on. I'm able to launch Chromium with this:
"shell_cmd": "/usr/bin/chromium-browser"
How do I also open the file I'm working on?
You should use the $file build system variable to refer to the full path of the current file:
"shell_cmd": "/usr/bin/chromium-browser $file"
On linux:
{
"cmd": ["google-chrome", "$file"]
}
Save your file as ViewInChrome.sublime-build (path is selected as ~/.config/sublime-text-3/Packages/User by default, if not select this path)
Is there a way to create a build command in Sublime Text that opens a new external window (terminal/cmd.exe)? Everything I try gets captured to the built-in output window.
I tried:
{
"cmd": ["ruby", "$file"],
"target": "cmd.exe",
"file_regex": "rb$",
"selector": "source.rb"
}
But nothing happened
The following works for Windows (I've tested it on XP and 7):
{
"cmd": ["start", "cmd", "/k", "c:/ruby193/ruby.exe", "$file"],
"selector": "source.ruby",
"shell": true,
"working_dir": "$file_dir"
}
Save it as Packages/User/Ruby_cmd.sublime-build (you may need to alter the path to the Ruby executable depending on your system), select Tools -> Build System -> Ruby_cmd, and build with CtrlB.
start does what it says it does, start a new process independent of Sublime Text. cmd is cmd.exe, the Windows command-line interpreter. The /k flag keeps the window open (at a new command prompt) after your program has run, allowing you to examine its output, look at tracebacks, run additional commands, etc.
May be you will find this solution helpful:
https://github.com/rctay/sublime-text-2-buildview
(transfers build output in the separate sublime tab, you can then do with it whatever you want)