Sublime Text 2 OSX Grunt build system woe - macos

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 ;)

Related

Auto run a command when terminal opens in Visual Studio Code on Mac

I'd like to run the command reload -b whenever a terminal opens in Visual Studio Code on a Mac. The accepted answer to a similar question gives a deprecated warning.
I've set my default profile (ZSH) and configured it as suggested in the docs, but the command still doesn't run.
Any help is much appreciated - thanks
My settings.json looks like:
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.defaultProfile.windows": "zsh",
"terminal.integrated.profiles.osx": {
"zsh (login)": {
"path": "zsh",
"args": [
"reload -b"
]
}
},

Unable to start debugging : The value of miDebuggerPath is invalid

I recently started working on vscode. I wanted to debug my C code. But the moment I am launching the debugger getting Error : Unable to start debugging. The value of miDebuggerPath is invalid.
I have my gdb installed on wsl . It's path is /usr/bin/gdb. I have copied same path to launch.json in miDebuggerPath.
Here is my launch.json :
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/main",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
It should not throw the error and I should able to launch my debugger.
So this happened to me on WSL-Ubuntu. In my case gdb was broken because of unmet dependencies. Took a while to fix but once I reinstalled gdb properly in my WSL-Ubuntu, I finally got it working.
Installing gdb can be done on shell as
sudo apt-get install gdb
There can be multiple reasons why it could end up as broken, but once you fix gdb, vscode-debugging should be running. At the very least, you won't see that error popping.
I had the same problem, my solution was:
1. Change this section in launch.json
"miDebuggerPath": "/usr/bin/gdb",
for:
"miDebuggerPath": "C:/MinGW/bin/gdb.exe",
2. Do you need to install in your PC MinGW, this is the link:
https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/
3. Next, open the MinGW then you install in the URL "C:/MinGW/bin" the gdb (select)
mingw32-gdb-bin
4. Enjoy the vs-code
it should be
"miDebuggerPath": "/usr/bin/gdbus",
If you're running under WSL, you should check where gdb is in your current distro to set your "miDebuggerPath" using
whereis gdb
in my case it was in
/usr/bin/gdb
but it could be somewhere else, that depends on what Linux distribution are you using with WSL
Could you try this:
sudo apt install binfmt-support
I am using VcXsrv, and this fixed all my installation problems, including chrome and GNU C++.
i had a similar problem ,this fixed. WINDOWS 10
QUICK ANSWER : try
1)C:\your compiler\bin\gdb.exe (paste your compiler path )
or
2)C:\TDM-GCC-32\bin\gdb32.exe for 32 bit compiler .(in my case)
(i tried to use opengl GLFW glad with 32bit tdm-gcc c++ compiler , i used a repo from OpenGL C++ template by vkphillia
but when i tried to run it in vs code using "run without debugging " option ,it showed the error "Unable to start debugging : The value of miDebuggerPath is invalid",
i copied my tdm_gcc compiler's bin path in midebugger path and it was like this ,
C:\TDM-GCC-32\bin\gdb.exe , but it did not remove the error then i checked for the gdb.exe application in my tdm gcc compiler bin where i noticed that there was no gdb.exe but a gdb32.exe file
I had the similar problem, running on linux.
Installing gdb fixed it.

Sublime Text 3 ; Conda Environment

I am extremely new to creating environments, and i'm having issues setting the directory path to the correct location. I have Anaconda install on this machine.
By default, it looks like it is going here:
[Errno 2] No such file or directory:
'/Users/examplename/anaconda3/bin/python' [cmd:
['/Users/examplename/anaconda3/bin/python', '-u',
'/Users/examplename/Desktop/python_work/test_pyenvironment.py']] [dir:
/Users/examplename/Desktop/python_work] [path:
/usr/bin:/bin:/usr/sbin:/sbin]
When my anaconda file location is actually in:
'MacintoshHD/anaconda3/bin/python'
Does anyone know how I can change where Sublime Text is looking, when trying to find this root folder? I'm not too sure about the PATH either, 'usr/bin:/bin:etc.' doesn't seem right?
Considering you are using your main anaconda env with pandas installed, you need to set a build system for your anaconda env. Like in this answer and mine you need to go to Tools ▶ Build System ▶ New Build System and set your custom build system:
{
"shell_cmd": "~/anaconda3/bin/python -u $file",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
}
And to use this custom build you have to select either Tools ▶ Build System ▶ Automatic or Tools ▶ Build System ▶ <your-custom-build-system-name> before building your code and/or to satisfy the Anaconda package for sublime.

env: ruby_executable_hooks: No such file or directory

When trying to build SASS, I'm getting the following error on Sublime Text 2. I've added the SASS build plugin from here https://github.com/jaumefontal/SASS-Build-SublimeText2
env: ruby_executable_hooks: No such file or directory
[Finished in 0.0s with exit code 127]
Not really sure what I should be doing here to troubleshoot this.
Thanks!!
The amount of negative votes tells me I need to add more information. The problem is I'm not quite sure what information I should be adding.
My SASS.sublime-build file inside /Library/Application Support/Sublime Text 2/Packages/SASS Build/
{
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache"],
"selector": "source.sass, source.scss",
"line_regex": "Line ([0-9]+):",
"osx":
{
"path": "/Users/vskylabv/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks:/usr/local/bin:$PATH"
},
"windows":
{
"shell": "true"
}
}
which ruby_executable_hooks
/Users/vskylabv/.rvm/gems/ruby-2.0.0-p247/bin/ruby_executable_hooks
The sass file being run is actually a script, with a hashbang line along the lines of #!/usr/bin/env ruby_executable_hooks (if it's not in sass, it's in another file being called). Sublime's environment is not necessarily the same as your command line environment, which is why you're getting the error message you're seeing. Open a terminal, and type
which ruby_executable_hooks
to find out the directory it lives in. Then, open Packages/SASS-Build/SASS.sublime-build:
{
"cmd": ["sass", "--update", "$file:${file_path}/${file_base_name}.css", "--stop-on-error", "--no-cache"],
"selector": "source.sass, source.scss",
"line_regex": "Line ([0-9]+):",
"osx":
{
"path": "/usr/local/bin:$PATH"
},
"windows":
{
"shell": "true"
}
}
If you're on OS X, change the "path" line in the "osx" section to:
"path": "/full/path/to/ruby_executable_hooks:/usr/local/bin:$PATH"
and save the file. Note the full path should just be the directory containing ruby_executable_hooks - for example, /Users/MichaelT/.rvm/gems/ruby-2.0.0-p247/bin.
Good luck!
You need to run the following command in the Terminal to refresh the executable-hooks to the latest version. That should take care of the issue.
sudo gem install --user-install executable-hooks
I had the same problem using an rvm installed version of sass in NetBeans 7.4.
You should switch to system ruby to avoid the rvm issues.
rvm use system
Now, check that you have sass in your system ruby:
gem list sass
Then if no sass, install the sass gem:
gem install sass
On OS X this will put sass into /usr/bin/sass
/usr/bin is in your path already so your sublime-build config should work.

How do I run a Ruby Gem via the Sublime Text 2 Build System?

I've tried different settings like simply:
{
"cmd": "rubocop '$file_name'"
}
I've also tried setting the path, etc:
{
"cmd": "rubocop '$file_name'",
"path": "~/.rvm/bin",
"selector": "source.rb",
"working_dir":"$project_path"
}
For both I get an error message along the lines of:
[Errno 2] No such file or directory
[cmd: rubocop 'configurer.rb']
[dir: /home/rafal/Documents/Projects/configurer]
[path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games]
[Finished]
and:
[Errno 2] No such file or directory
[cmd: rubocop 'configurer.rb']
[dir: /home/rafal/Documents/Projects/configurer]
[path: ~/.rvm/bin]
[Finished]
respectively. I have followed some of the tutorials I've found online as well as some of the answers here at StackOverflow but no luck. Any ideas on why this is happening? What is the correct and working way of running a Ruby Gem upon a currently open file? The Gem Rubocop is definitely installed.
I made the custom build work on SublimeText2 with
{
"env": {
"PATH":"${HOME}/.rvm/bin:${PATH}"
},
"cmd": ["rvm-auto-ruby", "-S", "bundle", "exec", "rubocop -n ${file}" ],
"selector": "source.ruby"
}
Note that the -n option of rubocop was introduced 5 days ago in the repo (after the 0.6.1 release), so it probably won't work if you don't use the rubocop from the git repo. Until 0.6.2 is released, it will display weird chars in the output, but at least it will work.

Resources