Coundn't upgrade ruby to install shopify client - ruby

I'm getting this error while installing the Shopify client.
[sudo] password for massil:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'shopify-cli' instead of './shopify-cli-2.1.0.deb'
The following NEW packages will be installed
shopify-cli
0 to upgrade, 1 to newly install, 0 to remove, and 1 not to upgrade.
Need to get 0 B/956 B of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 /<path-to-.deb-file>/shopify-cli-2.1.0.deb shopify-cli all 2.1.0 [956 B]
(Reading database ... 337058 files and directories currently installed.)
Preparing to unpack .../shopify/shopify-cli-2.1.0.deb ...
ERROR: Error installing shopify-cli:
There are no versions of theme-check (~> 1.1) compatible with your Ruby & RubyGems. Maybe try installing an older version of the gem you're looking for?
theme-check requires Ruby version >= 2.6. The current ruby version is 2.5.0.
dpkg: error processing archive /<path-to-.deb-file>/shopify-cli-2.1.0.deb (--unpack):
new shopify-cli package pre-installation script subprocess returned error exit status 1
Errors were encountered while processing:
/<path-to-.deb-file>/shopify-cli-2.1.0.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
It seems to be a problem in ruby version 2.5. I tried updating it to a higher version with apt, but it kept telling me that it was up to date. I then used rbenv and rvm to install higher versions, but it seems to be using, always, the system installed one, to install the Shopify client.
I'm using ubuntu 18.04
EDIT:
I ended up using gem install shopify-cli _2.7.2_ --version for the installations.

This is due to the fact that
theme-check library is not working with ruby lower then 2.6.
Unfortunately installing ruby with the standard way of :
sudo apt install ruby-full
does install the version:
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]
but an higher version can be installed following the rbenv method
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-
build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >>
~/.bashrc
exec $SHELL
rbenv install 3.0.2
rbenv global 3.0.2
ruby -v
after the version of ruby should be
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
and running
gem install shopify-cli
does install the latest shopify-cli
if this method does not work, try with the other 2 described here Install Ruby On Rails on
Ubuntu 18.04 Bionic Beaver

Related

Cannot use RSpec (rspec: command not found)

So I installed the newest version of Ruby:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
By following these steps:
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
I needed to change the Path so that I could use the newest version of Ruby since if not, whenever I did
ruby -v
It would just take into account the default ruby version I had installed in my MAC:
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
Everything works great but I want to install RSpec, so I do:
gem install rspec
This is what I get:
Successfully installed rspec-3.10.0
Parsing documentation for rspec-3.10.0
Done installing documentation for rspec after 0 seconds
1 gem installed
But once I check the version:
rspec --version
This is what I get:
-bash: rspec: command not found
I have uninstalled ruby with brew and installed it again and restarted the terminal but to no avail...Any idea why is this happening? How can I solve it?
Thank you!
It seems that installing Ruby via Home Brew was giving some problems when trying to run RSpec so I uninstalled it and installed it again via RVM. Although, as #Mskha said, Rbenv could also be a possible option.

Bundler finds the wrong version of ruby

I'm using OS X 10.10.5 (Yosemite). I'm trying to clone the github repo for MacDown. The instructions in the README say that after cloning one should do
git submodule init
git submodule update
bundle install
bundle exec pod install
I'm not a ruby programmer, so I had to install Bundler. The first two steps ran fine, but when I tried to run bundle install I got the error
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with the current version, ruby 2.0.0p481
So I tried brew install ruby and now I have
saul#miniMac ✓ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin14]
However, bundle install gives me the same error message as before. It's clear that it's finding the ruby at /usr/bin/ruby instead of the one at /usr/local/bin/ruby. How do I correct this?
I thought that perhaps the problem was that I had installed bundler before upgrading ruby, neither sudo gem uninstall bundler nor sudo gem uninstall bundle has any effect, and I don't know what else to try.
Here is all the output, in case it's relevant:
saul#miniMac ✓ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
activesupport-5.0.0.1 requires ruby version >= 2.2.2, which is incompatible with
the current version, ruby 2.0.0p481
EDIT:
Thanks for the suggestions. I tried gem install bundler again, but it didn't help. I got the same error message. Here's what I get from bundle env
saul#miniMac ✗ bundle env
Environment
Bundler 1.13.6
Rubygems 2.0.14
Ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Git 2.5.4 (Apple Git-61)
Gemfile
source 'https://rubygems.org'
gem 'cocoapods', '0.39.0'
Gemfile.lock
<No /Users/saul/Projects/macdown/Gemfile.lock found>
EDIT 2:
saul#miniMac ✓ which -a bundle
/usr/local/bin/bundle
/usr/bin/bundle
It seems that your PATH may have an entry that points to your older version of Ruby and despite having a newer version (2.3.1) it gets to use the first ruby binary it finds in one of the entries it finds in your PATH, which happens to be the old version. You could try to add your latest Ruby path as the first entry of your PATH variable, but in case a sub-shell is run and the default PATH is loaded the path to your latest Ruby would be overwritten. That being said, I think the easiest would be to use rvm here to make sure your environment is all set up with the version you intend to use at any given time. RVM can manage multiple versions of ruby in the same system. Read more about RVM here.
Run all the following commands in the same terminal window:
Install rvm: curl -sSL https://get.rvm.io | bash -s stable
Add rvm binary to PATH: export PATH="$PATH:$HOME/.rvm/bin"
Install ruby version you need: rvm install 2.3.1
Configure the current shell to use a specific version of Ruby like so: rvm use 2.3.1
Run bundle install again

Ruby gem show "Invalid argument" error for almost every command

I am working through NativeScript's set-up on OS X El Capitan and I am stuck at the point where I am supposed to install xcodeproj and cocoapods. Almost everything that I try to do with gem shows the same error:
$ sudo gem install xcodeproj
ERROR: While executing gem ... (Errno::EINVAL)
Invalid argument
The following commands show the same error, wether I run it with sudo or not:
$ gem update --system
$ gem update
$ gem install whatever
$ gem install cocoapods
I have the following versions:
$ ruby --version
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
$ gem --version
2.6.7
I've tried some of the help that I've found online, including reinstalling gem and ruby, restarting but nothing has helped.
I guess that I have a configuration problem with Ruby.
Any suggestions on how to troubleshoot this?
I just had a similar issue after updating everything via Homebrew.
I solved the issue by uninstalling Ruby and installing it via rbenv, then reinstalling cocoa pods.
Steps:
Uninstall ruby
brew uninstall ruby
Install rbenv and ruby-build
brew install rbenv ruby-build
You need to add Ruby to your path.
A. If Terminal is your shell.
Add eval "$(rbenv init -)" to ~/.bash_profile
B. Or if you use another shell
You can find the instruction by entering the command rbenv init NAME_OF_YOUR_SHELL.
Install Ruby
rbenv install 2.3.1
Set the Ruby version
rbenv global 2.3.1
rbenv local 2.3.1
Reinstall Cocoapods
gem install cocoapods

Unable to install rbenv 2.0.0

I'm trying to install rbenv 2.0.0. So, I type
rbenv install 2.0.0
And it displays the following error :
ruby-build: definition not found: 2.0.0
See all available versions with `rbenv install --list'.
If the version you need is missing, try upgrading ruby-build:
cd /home/jay/.rbenv/plugins/ruby-build && git pull
So, I navigate to the above location and do git pull to upgrade ruby build.
Now when I try rbenv install --list, Available versions: and none are displayed.
Does any one know what might be wrong ?
Ruby version installed shows ruby 2.1.2p95 (2014-05-08 revision 45877) [i686-linux]

.rbenv/versions/2.0.0-p353/bin/ruby: No such file or directory on Cygwin

To install rbenv, I installed Cygwin and some required packages (gcc, openssl, libssl, libxml, etc). Then, cloned repositories and appended to.zshrc.
$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugin
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
$ echo 'eval "$(rbenv init -)"' >> ~/.zshrc
Restarted cygwin and ran this command.
rbenv install 2.0.0-p353
However I got this error.
$ rbenv install 2.0.0-p353
Downloading ruby-2.0.0-p353.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/78282433fb697dd3613613ff55d734c1
Installing ruby-2.0.0-p353...
BUILD FAILED
Inspect or clean up the working tree at /tmp/ruby-build.20140211033802.7944
Results logged to /tmp/ruby-build.20140211033802.7944.log
Last 10 log lines:
installing default gems: /cygdrive/c/Users/MY_NAME/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0 (build_info, cache, doc, gems, specifications)
bigdecimal 1.2.0
io-console 0.4.2
json 1.7.7
minitest 4.3.2
psych 2.0.0
rake 0.9.6
rdoc 4.0.0
test-unit 2.0.0.0
/cygdrive/c/Users/MY_NAME/.rbenv/plugins/ruby-build/bin/ruby-build: line 759: /cygdrive/c/Users/MY_NAME/.rbenv/versions/2.0.0-p353/bin/ruby: No such file or directory
/tmp/ruby-build.20140211033802.7944 is here:
https://gist.github.com/anonymous/a9e099a4335ae59a9714
I found a function related to openssl around line 759 of ruby-build, but I may have installed
it.
Any ideas on why versions/2.0.0-p353/bin/ruby doesn't exist?

Resources