Closed AbdullahAs closed 1 year ago
tldr; if you've recently switched shells (bash
to zsh
) or made another equivalently large change to your shell, try rebooting your system. I know this is entirely unsatisfying. But this fixed a similar problem for me.
I had the same problem after I switched my MacOS default shell from bash
to zsh
. As part of the switch, I moved the contents of ~/.bashrc
to ~/.zshrc
So bash
no longer had access to my Ruby version manager (asdf
in my case) and was now running the system Ruby (which didn't have any gems installed)
I could reproduce the error if I opened a bash
terminal in VSCode and ran bundle list --name-only
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
sapphire:srb will$ bundle list --name-only
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.3.4) required by your /Users/will/Working/PharmacySystems/SignylForRehab/srb/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.
To install the missing version, run `gem install bundler:2.3.4`
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
from /usr/bin/bundle:23:in `<main>'
sapphire:srb will$
But if I opened a zsh
terminal and ran bundle list --name-only
, I would see the correct output
will@sapphire srb % bundle list --name-only
actioncable
actionmailbox
actionmailer
actionpack
actiontext
actionview
activejob
activemodel
.
.
.
The problem for me was that, for some reason, VSCode was still running extension shell commands in bash instead of zsh. So when the Standard extension attempted to run bundle list --name-only
(via child_process.exec
BTW https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback) it was running in a bash shell.
After an afternoon of
code .
) or from Spotlight (cmd+space, search for Visual Studio Code, press enter), VSCode defaulted to the zsh
shell and everything worked. But if I ran VSCode from Finder or the Dock, VSCode used the bash
shell and everything did not work...I finally tried rebooting my laptop (which I had not done since switching shells) After that everything worked. It "just works" now.
I don't know if this is the source of your problem. But I would look into what shell you normally run and what shell VSCode is using for extensions and in it's terminal. Hope this helps point you in the right direction.
Eek, thanks @willkoehler! Hopefully this was the issue
Testing in a new fresh app, and when attempting to run the extension, it indicates that some gems are not installed, despite the fact that they are installed.
Error:
Manually running:
bundle list --name-only