Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew cask style error #43898

Closed
6 tasks done
brianbrownton opened this issue Feb 12, 2018 · 14 comments
Closed
6 tasks done

brew cask style error #43898

brianbrownton opened this issue Feb 12, 2018 · 14 comments

Comments

@brianbrownton
Copy link
Contributor

brianbrownton commented Feb 12, 2018

General troubleshooting steps

Description of issue

Issue discovered while trying to run @vitorgalvao's cask-repair (getting red dot error outputs).

Output of your command with --verbose --debug

$ brew cask style --verbose --debug
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- parser (LoadError)
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.52.1/lib/rubocop.rb:3:in `<top (required)>'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
	from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/gems/rubocop-0.52.1/bin/rubocop:6:in `<top (required)>'
	from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/bin/rubocop:22:in `load'
	from /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/bin/rubocop:22:in `<main>'
Error: style check failed
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/style.rb:15:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:98:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:173:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:173:in `rescue in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:156:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

Output of brew cask doctor

$ brew cask doctor
==> Homebrew-Cask Version
Homebrew-Cask 1.5.4-12-ge904983
caskroom/homebrew-cask (git revision 87e5af; last commit 2018-02-12)
==> macOS
10.13.2
==> SIP
Enabled
==> Java
N/A
==> Homebrew-Cask Install Location
<NONE>
==> Homebrew-Cask Staging Location
/usr/local/Caskroom
==> Homebrew-Cask Taps:
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask (3913 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-drivers (141 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-fonts (1159 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions (173 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-eid (10 casks)
==> Contents of $LOAD_PATH
/usr/local/Homebrew/Library/Homebrew/cask/lib
/usr/local/Homebrew/Library/Homebrew
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/gems/2.3.0/gems/did_you_mean-1.0.0/lib
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/site_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby/2.3.0/universal-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/vendor_ruby
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/x86_64-darwin9.0
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/universal-darwin9.0
==> Environment Variables
LC_ALL="en_US.UTF-8"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm"
SHELL="/bin/bash"

What is interesting is that after I started experiencing this issue I tried to brew rm ruby@2.3 (which is what I had installed) and brew install ruby which got me to ruby 2.5. However the $LOAD_PATH in homebrew still has a bunch of 2.3.3 paths...

$ which ruby
/usr/local/Cellar/ruby/2.5.0/bin/ruby

$ which gem
/usr/local/Cellar/ruby/2.5.0/bin/gem

$ ruby --version
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]

$ ruby env
Traceback (most recent call last):
ruby: No such file or directory -- env (LoadError)

When I previously had a problem with cask-repair there was gem command for removing rubocop and rubocop-cask which I tried again, but they were already removed and the gems were gone from ~/.gem and the subdirs. It was after this that I tried to upgrade ruby.

Help appreciated in getting brew cask style (and by extension cask-repair) working again!

@brianbrownton
Copy link
Contributor Author

This ended up being a bit of a problem... I removed my ruby installs (except system) and installed rbenv and ruby 2.5.0.

After a bit of tinkering with brew config and looking through some of the source files, I found that renaming

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0/

to

/usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0-old

and then running brew cask style again fixed everything:

$ brew cask style
==> Installing or updating 'rubocop-cask' gem
Fetching: public_suffix-3.0.2.gem (100%)
Successfully installed public_suffix-3.0.2
Fetching: parallel-1.12.1.gem (100%)
Successfully installed parallel-1.12.1
Fetching: ast-2.4.0.gem (100%)
Successfully installed ast-2.4.0
Fetching: parser-2.4.0.2.gem (100%)
Successfully installed parser-2.4.0.2
Fetching: powerpack-0.1.1.gem (100%)
Successfully installed powerpack-0.1.1
Fetching: rainbow-3.0.0.gem (100%)
Successfully installed rainbow-3.0.0
Fetching: ruby-progressbar-1.9.0.gem (100%)
Successfully installed ruby-progressbar-1.9.0
Fetching: unicode-display_width-1.3.0.gem (100%)
Successfully installed unicode-display_width-1.3.0
Fetching: rubocop-0.52.1.gem (100%)
Successfully installed rubocop-0.52.1
Fetching: rubocop-cask-0.16.0.gem (100%)
Successfully installed rubocop-cask-0.16.0
10 gems installed

0 files inspected, no offenses detected

This seems to have recreated the original 2.3.0 directory at the above path... so I just removed the 2.3.0-old directory and things seem to be going alright.

@vitorgalvao
Copy link
Member

Closing since it was solved.

@commitay
Copy link
Contributor

Looks like running style without a token doesn't check anything. Reproducible.

$ brew cask style

...

0 files inspected, no offenses detected

@commitay commitay reopened this Feb 12, 2018
@commitay commitay added bug Issue describing a reproducible bug. awaiting maintainer feedback Issue needs response from a maintainer. core Issue with Homebrew itself rather than with a specific cask. labels Feb 12, 2018
@brianbrownton
Copy link
Contributor Author

@commitay the inferred problem being that brew cask style with no token/arguments should scan all casks?

The man page would back this up...

style [--fix] [ token ... ]
Check the given Casks for correct style using RuboCop Cask https://github.com/caskroom/rubocop-cask. If no tokens are given on the command line, all Casks are checked. With --fix, auto-correct any style errors if possible.

@commitay
Copy link
Contributor

Yeah, it was working a couple of weeks ago.

@gtmgianni
Copy link
Contributor

@CryoRenegade I believe you're getting this error because there is no cask named jgrasp-beta in the official homebrew-versions repository, hence the error message No Cask with this name exists.
However, if you have created a cask named jgrasp-beta locally, then there's probably something wrong with one of the stanzas in the cask file you've created, not with the brew cask style command.

Just so you know @commitay, I can reproduce your issue with running brew cask style with no tokens, and it not checking any casks.

@reitermarkus
Copy link
Member

Looks like running style without a token doesn't check anything. Reproducible.

Works for me:

5406 files inspected, 5 offenses detected

@commitay
Copy link
Contributor

Clean VM, new install of Homebrew on master:

$ brew cask style
==> Installing or updating 'rubocop-cask' gem
Fetching: public_suffix-3.0.2.gem (100%)
Successfully installed public_suffix-3.0.2
Fetching: parallel-1.12.1.gem (100%)
Successfully installed parallel-1.12.1
Fetching: ast-2.4.0.gem (100%)
Successfully installed ast-2.4.0
Fetching: parser-2.4.0.2.gem (100%)
Successfully installed parser-2.4.0.2
Fetching: powerpack-0.1.1.gem (100%)
Successfully installed powerpack-0.1.1
Fetching: rainbow-3.0.0.gem (100%)
Successfully installed rainbow-3.0.0
Fetching: ruby-progressbar-1.9.0.gem (100%)
Successfully installed ruby-progressbar-1.9.0
Fetching: unicode-display_width-1.3.0.gem (100%)
Successfully installed unicode-display_width-1.3.0
Fetching: rubocop-0.52.1.gem (100%)
Successfully installed rubocop-0.52.1
Fetching: rubocop-cask-0.16.0.gem (100%)
Successfully installed rubocop-cask-0.16.0
10 gems installed

0 files inspected, no offenses detected

@reitermarkus Do you have another rubocop-cask in your PATH?

@vitorgalvao
Copy link
Member

Tried this on my own machine and on a VM.

VM:

$ brew cask --version 
Homebrew-Cask 1.5.4
caskroom/homebrew-cask (git revision c959c; last commit 2018-02-15)

$ brew cask style
0 files inspected, no offenses detected

non-VM:

$ brew cask --version
Homebrew-Cask 1.5.4-40-g988e805
caskroom/homebrew-cask (git revision c959c; last commit 2018-02-15)

$ brew cask style
5398 files inspected, no offenses detected

@rifaidev
Copy link
Contributor

rifaidev commented Feb 17, 2018

I've a similar issue running brew cask style produce the following error:

==> Installing or updating 'rubocop-cask' gem
Error: Unable to resolve dependency: user requested 'did_you_mean (= 1.0.0)'
Follow the instructions here:
  https://github.com/caskroom/homebrew-cask#reporting-bugs
/Library/Ruby/Site/2.3.0/rubygems/resolver.rb:231:in `search_for'
/Library/Ruby/Site/2.3.0/rubygems/resolver.rb:283:in `block in sort_dependencies'
/Library/Ruby/Site/2.3.0/rubygems/resolver.rb:277:in `each'
/Library/Ruby/Site/2.3.0/rubygems/resolver.rb:277:in `sort_by'
/Library/Ruby/Site/2.3.0/rubygems/resolver.rb:277:in `with_index'
/Library/Ruby/Site/2.3.0/rubygems/resolver.rb:277:in `sort_dependencies'
/Library/Ruby/Site/2.3.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:52:in `block in sort_dependencies'
/Library/Ruby/Site/2.3.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:69:in `with_no_such_dependency_error_handling'
/Library/Ruby/Site/2.3.0/rubygems/resolver/molinillo/lib/molinillo/delegates/specification_provider.rb:51:in `sort_dependencies'
/Library/Ruby/Site/2.3.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:165:in `initial_state'
/Library/Ruby/Site/2.3.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:106:in `start_resolution'
/Library/Ruby/Site/2.3.0/rubygems/resolver/molinillo/lib/molinillo/resolution.rb:64:in `resolve'
/Library/Ruby/Site/2.3.0/rubygems/resolver/molinillo/lib/molinillo/resolver.rb:42:in `resolve'
/Library/Ruby/Site/2.3.0/rubygems/resolver.rb:188:in `resolve'
/Library/Ruby/Site/2.3.0/rubygems/request_set.rb:385:in `resolve'
/Library/Ruby/Site/2.3.0/rubygems/request_set.rb:397:in `resolve_current'
/Library/Ruby/Site/2.3.0/rubygems.rb:245:in `finish_resolve'
/Library/Ruby/Site/2.3.0/rubygems/rdoc.rb:15:in `<top (required)>'
/Library/Ruby/Site/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/Library/Ruby/Site/2.3.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/Library/Ruby/Site/2.3.0/rubygems/commands/install_command.rb:280:in `load_hooks'
/Library/Ruby/Site/2.3.0/rubygems/commands/install_command.rb:156:in `execute'
/usr/local/Homebrew/Library/Homebrew/utils.rb:227:in `install_gem_setup_path!'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/style.rb:21:in `block in install_rubocop'
/usr/local/Homebrew/Library/Homebrew/utils.rb:400:in `capture_stderr'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/style.rb:19:in `install_rubocop'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/style.rb:11:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:35:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:98:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

Output of brew cask doctor

==> Homebrew-Cask Version
Homebrew-Cask 1.5.4-46-gef1924e
caskroom/homebrew-cask (git revision 5afc9; last commit 2018-02-17)
==> macOS
10.13.3
==> SIP
Enabled
==> Java
N/A
==> Homebrew-Cask Install Location
<NONE>
==> Homebrew-Cask Staging Location
/usr/local/Caskroom
==> Homebrew-Cask Cached Downloads
~/Library/Caches/Homebrew/Cask
==> Homebrew-Cask Taps:
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask (3917 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-drivers (141 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-fonts (1159 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-versions (171 casks)
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-eid (10 casks)
==> Contents of $LOAD_PATH
/usr/local/Homebrew/Library/Homebrew/cask/lib
/usr/local/Homebrew/Library/Homebrew
/Library/Ruby/Gems/2.3.0/gems/did_you_mean-1.0.0/lib
/Library/Ruby/Gems/2.3.0/gems/json-2.1.0/lib
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/json-2.1.0
/Library/Ruby/Gems/2.3.0/gems/psych-3.0.2/lib
/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/psych-3.0.2
/Library/Ruby/Site/2.3.0
/Library/Ruby/Site/2.3.0/x86_64-darwin17
/Library/Ruby/Site/2.3.0/universal-darwin17
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin17
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0/universal-darwin17
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/x86_64-darwin17
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin17
==> Environment Variables
LC_ALL="en_US.UTF-8"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm"
SHELL="/usr/local/bin/zsh"

I've brew ruby installed too:

$ which ruby
/usr/local/bin/ruby

$ which gem
/usr/local/bin/gem

$ ruby --version
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]

$ gem --version
2.7.4

@MindTooth
Copy link
Contributor

MindTooth commented Feb 20, 2018

I seem to solved mine doing:

gem uninstall -i /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0 rubocop-cask

or

gem uninstall -i /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0 rubocop

or (fish-shell way)

set -x GEM_PATH /usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby/2.3.0

And last running brew cask style to re-install the missing gems.

Either way, I managed to make mine working again. Needed to solve this so I could run cask-repair.

@rifaidev
Copy link
Contributor

Well, I found that don't have a bundle folder into this path /usr/local/Homebrew/Library/Homebrew/vendor.

Doing some researching and reading through those issues Homebrew/brew#3760, Homebrew/brew#3781, Homebrew/brew#3736.

I decided to go back to this version of utils.rb file, right before those changes to ENV["GEM_HOME"], ENV["GEM_PATH", and everything worked fine for me!

However running brew cask style installed rubocop and rubocop-cask to the system /usr/bin/gem not the one installed via brew /usr/local/bin/gem.

$ which -a gem
/usr/local/bin/gem
/usr/bin/gem

$ gem --version
2.7.6

$ /usr/local/bin/gem --version
2.7.6

$ /usr/bin/gem  --version
2.7.2

I don't know much about ruby/gem, however I tried to add helpful info as much as I can.

Mentioning @MikeMcQuaid since he is the owner of those commits.

@commitay
Copy link
Contributor

However running brew cask style installed rubocop and rubocop-cask to the system /usr/bin/gem not the one installed via brew /usr/local/bin/gem.

Homebrew uses system ruby or its own portable ruby if system ruby is to old.

I decided to go back to this version of utils.rb file

I'd recommend not doing this.

Well, I found that don't have a bundle folder into this path /usr/local/Homebrew/Library/Homebrew/vendor.

@abdelrahmanrifai Please open a new issue for this.

@commitay
Copy link
Contributor

Closing as the original user issue was resolved.

style without tokens not working moved to #44190

@commitay commitay removed awaiting maintainer feedback Issue needs response from a maintainer. bug Issue describing a reproducible bug. core Issue with Homebrew itself rather than with a specific cask. labels Feb 21, 2018
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants