env: ruby_executable_hooks: No such file or directory - ruby

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.

Related

VSCODE faill to install tools in go module

when starting a go module on VSCode I get prompted to install some tool
choosing install the installation fails, below the logs in vscode terminal
VSCODE keeps yelling at me an "fail to install" stuff, simply because ignores my path
as you can see below
Tools environment: GOPATH=/home/go
Installing 1 tool at /home/go/bin in module mode.
gopls
Installing golang.org/x/tools/gopls FAILED
1 tools failed to install.
gopls: failed to install gopls(golang.org/x/tools/gopls): Error: Command failed: /usr/local/go/bin/go get -v golang.org/x/tools/gopls
go: writing stat cache: mkdir /home/go: permission denied
go: downloading golang.org/x/tools/gopls v0.5.1
go: downloading golang.org/x/tools v0.0.0-20201017001424-6003fad69a88
go get golang.org/x/tools/gopls: mkdir /home/go: permission denied
undefined
these are my GOPATH and GOROOT
# GOLANG
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
export PATH=$GOROOT/bin:$PATH
and this is my vscode settings.json
{
"[dart]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.rulers": [
80
],
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": false
},
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "One Dark Pro",
"dart.sdkPath": "/home/francesco/development/dart",
"dart.openDevTools": "flutter",
"go.formatTool": "goimports",
"dart.checkForSdkUpdates": false,
"go.useLanguageServer": true,
"go.inferGopath": false,
"go.gopath": "/home/go",
"go.goroot": "/usr/local/go"
}
what action should I take to fix the error?
Your error is:
go: writing stat cache: mkdir /home/go: permission denied
Go tries to write to /home/go. This folder is derived from:
export GOPATH=$HOME/go
So it looks your $HOME doesn't point to your home folder. GOPATH should point to a folder where you have write permission, because the module cache is located under GOPATH. So it should point to a folder under your user home, e.g. /home/francesco/go.
I recently solved this problem on my Windows machine. At first I had thought it was a file permissions problem. But it was a GOPATH environment variable problem.
I had it set to 2 values: C:\Program Files\Go (which is where I installed Go) and C:.... which was where I wanted all my Go projects to go.
So I removed the first entry. Just leaving GOPATH to point to the place on my hard drive where I wanted all my projects, and hey presto, problems gone, all tools installed correctly.
This may have been due to a previous version of Go not being entirely removed.

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.

Visual Studio Code terminal shell vs task shell missing rvm

I use RVM to change Ruby versions in my Mac-based development environment.
Inside Visual Studio Code, when I open a regular Terminal tab, I'm dropped into a bash login shell with the -l option, per the standard default configuration, and as documented here:
// VSCode default settings
{
"terminal.integrated.shell.osx": "/bin/bash",
"terminal.integrated.shellArgs.osx": [
"-l"
]
}
The RVM command executed manually from VSCode Terminal gives me the expected ruby version for this project by default.
$ rvm list
ruby-2.0.0-p648 [ x86_64 ]
ruby-2.1.10 [ x86_64 ]
ruby-2.1.5 [ x86_64 ]
ruby-2.2.10 [ x86_64 ]
ruby-2.2.5 [ x86_64 ]
ruby-2.3.0 [ x86_64 ]
* ruby-2.3.1 [ x86_64 ]
=> ruby-2.3.7 [ x86_64 ]
# => - current
# =* - current && default
# * - default
However, when I setup a .vscode/tasks.json file to execute that same command the Ruby version is NOT the correct version, but the default one on the system. Futhermore, I'm unable to actually use rvm use to switch versions (see error message below)
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Check for RVM",
"type": "shell",
"command": "rvm list && rvm use 2.3.7",
"group": {
"kind": "test",
"isDefault": true
}
}
}
}
Output of task execution, with error message about not having a correct login shell.
> Executing task: rvm list && rvm use 2.3.7 <
ruby-2.0.0-p648 [ x86_64 ]
ruby-2.1.10 [ x86_64 ]
ruby-2.1.5 [ x86_64 ]
ruby-2.2.10 [ x86_64 ]
ruby-2.2.5 [ x86_64 ]
ruby-2.3.0 [ x86_64 ]
=* ruby-2.3.1 [ x86_64 ]
ruby-2.3.7 [ x86_64 ]
# => - current
# =* - current && default
# * - default
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.
Terminal will be reused by tasks, press any key to close it.
I've even tried specifically adding the -l bash command option as an argument in the Task's configuration, but this does not work.
"options": {
"shell": {
"args": "-l"
}
}
My understanding, after reading through this issue is that the Terminal shell config and the Task shell config is one and the same, so is there some other underlying inconsistency between Terminal shell and Task shell that I'm missing? If not, then what is it about RVM that prevents it from working inside a Task shell?
RVM overrides the 'cd' command to detect the .ruby-version and .ruby-gemset files and automatically set up your environment. A newly initiated vscode terminal doesn't trigger that. It only uses the default or current settings from when vscode was started, NOT what you have defined in your .ruby* files.
So I usually run cd $PWD when starting a new terminal in vscode.
When defining a rake task in tasks.json, my command line is like so:
{
"label": "rake db:migrate",
"type": "shell",
"command": "cd $PWD; rake db:migrate",
"problemMatcher": []
},
Note the cd $PWD prepended to the command line, to hook into rvm.
It's kludgy. But it's working for me so far.
I suspect this non-awareness of rvm/.ruby-gemset/.ruby-version is also preventing vscode's automatic detection of rake tasks that the Ruby plugin is supposed to do, as mentioned here https://medium.com/hack-visual-studio-code/rake-task-auto-detection-in-vscode-ce548488755e. So any rake tasks I want to run via vscode tasks have to be defined manually by me this way.
Hope this helps.
I had similar issue with starting up Rails inside VS Code tasks on MacOS, with zsh as default shell.
Fix was to use --login vs -l. For example:
{
"label": "Rails Sample",
"type": "shell",
"command": "cd rails-sample && bin/rails server",
"options": {
"shell": {
"args": ["--login"]
}
},
"isBackground": true,
"problemMatcher": [],
"presentation": {
"group": "rails-sample"
}
}
When I was using -l it would show me error like:
Your Ruby version is 2.6.3, but your Gemfile specified 3.0.2
The terminal process "/bin/zsh '-c', 'cd rails-sample && bin/rails server'" terminated with exit code: 18.
The reason I tried --login was because I came across this issue, even though I have the latest version of VS Code. It could be due to setup on my machine.

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.

Sublime Text 2 OSX Grunt build system woe

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

Resources