Error when running gem specific_install - ruby

I am trying to run 'gem specific_install' (https://github.com/rdp/specific_install) to install another gem from a Github repository:
sudo gem specific_install https://github.com/RemoteRepository/foo_gem.git
After being prompted for my Github Username and password, I am able to download the gem. However, I get the following error:
ERROR: While executing gem ... (NoMethodError)
undefined method `build' for Gem::Package:Module
Apparently, other people have the same error based on a comment to a specific_install related answer to this question: How to install gem from GitHub source?
How can this error be resolved?

According to this issue this is due to an outdated version of gem (rubygems).
Updating gem should fix it, if you are using rvm you should run rvm rubygems current (this worked for me), if you are not using rvm I believe you should follow How to upgrade rubygems.

Related

Certificate failure and Windows10 gem version 2.4.5.1

I'm new to much of this:
My problem begins at the rails new sample_app stage of the installrails.com process.
it does its thing, getting to run bundle install and errors with "Could not verify the SSL certificate for https://rubygems.org/."
I search and learn I must update certificates, as discussed here: http://guides.rubygems.org/ssl-certificate-update/
I learn at the above page that rubygems 2.4.x is broken for windows, and therefore no download exists to update my certificates.
So I try to update $ gem update --system 2.6.7 and this is what is returned:
Updating rubygems-update
ERROR: Error installing rubygems-update:
Unable to resolve dependency: user requested 'rubygems-update (= 2.6.7)'
ERROR: While executing gem ... (NoMethodError)
undefined method `version' for nil:NilClass
I keep trying to figure out how to do something so simple as uninstall my gem version 2.4.5.1 and install 2.6.7 but can't do it... my syntax?
I have also seen a workaround using these:
gem sources --remove https://rubygems.org/
gem sources -a http://rubygems.org/
But I don't understand how that helps with certificates or how it is a permanent solution! I removed the secure source, and cannot reobtain it because of the same certificate error. So now I am stuck with the http one. Thanks for your help!
Okay so I started fresh after posting the question.
I used the work around to bypass the certificate problem:
gem sources --remove https://rubygems.org/
gem sources -a http://rubygems.org/
This then allowed me to update my gem version.
gem update --system
Then I switched gem sources back:
gem sources --remove http://rubygems.org/
gem sources -a https://rubygems.org/
I ran into another problem when running rails new sample_app at the same place, bundle install. I found the fix here: Ruby on Rails cannot bundle install
my command was gem install bundler
then I was able to successfully create the sample app. Looking forward to the next problem!

Cocoapods Intall ERROR: While executing gem (TypeError)

I have a problem when I try to install the cocoapods gem on Mac. When I typed in:
$ sudo gem install cocoapods
on terminal, it shows the error:
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
How do I install the cocapods gem on Mac?
Luckly, I solved this by check this Upgrading to rubygems 2.5.x breaks future up/downgrades
Accordding to what Segiddins said, this problem might be a bug in the old version, which has been fixed in RubyGems 2.6.2, just try upgrading your gems to RubyGems 2.6.2.
I also got the same error. Try below command
sudo gem install -n /usr/local/bin cocoapods
and see if it works.

Error: SASS installation for windows

am trying to install sass after installing ruby, but iam getting following error, please help me to fix this
maradhak#WW730VW7X1688 /c/softwares
$ gem -v
2.2.2
maradhak#WW730VW7X1688 /c/softwares
$ gem install sass
ERROR: Could not find a valid gem 'sass' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect retur
ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
https://rubygems.org/latest_specs.4.8.gz)
The error has something to do with being vulnerable to the Poodle SSL bug, it will not be verified for that reason. If there's a way to upgrade to a better certificate, but at the time of writing this answer, I could not find the upgraded certificate.
I used the non-SSL host instead, altough I should note that this is not the best nor a permanent solution, it lacks security.
The command used:
gem source -a http://rubygems.org/
A discussion about this subject can be found here: https://github.com/rubygems/rubygems/issues/515#issuecomment-65326585
Update: There seems to be a permanent solution now, which replaces the certificate with a proper protected one. It can be found on the following URL, an tutorial is included in that page.
https://gist.github.com/luislavena/f064211759ee0f806c88#installing-using-update-packages-new
Short answer:
gem sources -a http://rubygems.org/
Confirm than you don't really care about that specific warning, since you trust rubygems.org. Then:
gem install sass
And it works.
thanks for your suggestions, as you guys said this seems to be SSH update issue.
have solved this issue simply down graded my RUBY version from "2.1.5" to "1.8", and the gem version is "1.8.29".
then i was able to install SASS
Following worked for me:
Remove the https source temporary, run gem update --system and then switch back to https.
gem sources --remove https://rubygems.org/
gem sources --add http://rubygems.org
gem update --system
gem sources --remove http://rubygems.org
gem sources --add https://rubygems.org
Ref: https://github.com/rubygems/rubygems/issues/1736
I also encountered the same problem today。
Running gem install sass returned
ERROR: Could not find a valid gem 'sass' (>= 0), here is why:Unable to download data from https://rubygems.org/ -SSL_connect returned=1 errno=0 state=SSLv3read server certificate B: certificate verify failed(https://api.rubygems.org/specs.4.8.gz)
Then I find a way to fix it:
gem sources -a http://rubygems.org/
gem install sass
Adding http://rubygems.org/ to sources solves this.
Here is a capture of my terminal
For me it was a proxy issue. When I appended the proxy details to the gem install command it worked.
gem install sass --http-proxy=http://<yourproxy>:<port>
The first step to Rubygems(http://rubygems.org/) then download sass on(http://rubygems.org/gems/sass)
put in: npm install
You don't need to disable SSH or downgrade your ruby version, you can simply install the SASS gem manually. Here's how to do it:
On windows, first install the Ruby installer for windows.
Download the latest version of the gem from here:
https://rubygems.org/gems/sass Click the latest version, and then on
the right side of the screen (in Links section) click the "Download"
link to download the original gem file (sass-*.*.*.gem)
Now paste the downloaded gem file to the directory that ruby is
installed on: C:\Ruby22-x64\bin\sass-*.*.*.gem
In Command Prompt run the following commands:
cd C:Ruby22-x64/bin
gem install sass-*.*.*.gem1
NOTE: You may also need to call the local flag while installing the gem: gem install --local C:Ruby22-x64/bin/sass-*.*.*.gem
Install a full fledged Cygwin on your windows, the ssh support is good in it. You should be able to install it without any extra efforts, well I always do. In fact once you have Cygwin install you would hardly use the command prompt.
I'm totally new to Ruby and Sass. I didn't want to risk security and I'm on a Windows machine. I had already installed latest ruby, but kept getting the same error message as the OP when trying to run gem install sass at the command prompt.
Here's what solved the problem for me.
Go to: https://rubygems.org/pages/download and follow the instructions on the page starting here (for manual installation):
If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually:
Download from above (URL above)
Unpack/unzip into a directory and cd there (into the directory you unzipped it)
Install with: ruby setup.rb (at the command line type that command. You may need admin/root privilege)
After I installed ruby gems, I opened Ruby command prompt (using Start Command Prompt with Ruby from the start menu) and ran the command gem install sass and it worked:
C:\Users\chris>gem install sass
Fetching: sass-3.4.22.gem (100%)
Successfully installed sass-3.4.22
Parsing documentation for sass-3.4.22
Installing ri documentation for sass-3.4.22
Done installing documentation for sass after 36 seconds
1 gem installed
Wanted to detail it as much as possible for other newbies like me. Hope this helps someone.
Changing from http to https makes your computer vulnerable to hackers
I explain some solutions in my answer here: https://stackoverflow.com/a/40075753/845413
If you found this error by searching and are using RVM on OSX just run.
rvm osx-ssl-certs update all
Bundler outlines a few other solutions in their troubleshooting guide for this error: http://bundler.io/v1.16/guides/rubygems_tls_ssl_troubleshooting_guide.html#troubleshooting-certificate-errors
and include...
gem install bundler
gem update --system
Finally, you can simply reinstall RVM or rubygems manually.
Manually install Ruby gems: https://rubygems.org/pages/download
Manually install RVM (recommended): http://rvm.io/

Error running gem env

When I run gem env, I get the following error:
Error loading RubyGems plugin "/home/chenge/.rvm/gems/ruby-1.9.2-p320#global/gems/rubygems-bundler-0.9.2/lib/rubygems_plugin.rb": undefined method `first' for #<String:0x8ec8670> (NoMethodError)
Could anybody help me to understand what this means? Thanks.
gem clean
Cleaning up installed gems...
Attempting to uninstall rvm-1.11.3.3
Unable to uninstall rvm-1.11.3.3:
Gem::InstallError: gem "rvm" is not installed
Attempting to uninstall rubygems-bundler-0.9.2
Unable to uninstall rubygems-bundler-0.9.2:
Gem::InstallError: gem "rubygems-bundler" is not installed
Attempting to uninstall bundler-1.1.3
Unable to uninstall bundler-1.1.3:
Gem::InstallError: gem "bundler" is not installed
Clean Up Complete
Your rubygems-bundler is out-date(0.9.2), install the latest version(1.1.0) will fix that.
$ gem clean
$ gem install rubygems-bundler
I tried on my EC2 instance, it works.
the problem may be caused by:
incorrectly installed Ruby
incorrectly installed RubyGem
incorrectly installed RVM
I suggest you remove the rubygem entirely. ( rm /home/chenge/.rvm/gems -rf ) and then download the latest rubygem then re-install it.

Uninitialized constant Psych::Syck on gem install

I pushed a gem up to rubygems.org, and when I do a 'gem install (gem)' I get this error:
ERROR: While executing gem ... (NameError)
uninitialized constant Psych::Syck
I can do a 'gem build (gem).gemspec' to generate a local gem and then gem install (gem).gem and that installs fine. I can also put the gem into my Rails' app's Gemfile with a pointer to the Github repo and that will also work. I have tried installing the gem (from rubygems.org on multiple computers and they all get the same error.
I am out of ideas as to what can be causing the install to fail when done from rubygems.org but not when I generate it locally. I am using Jeweler to push the gem up to rubygems.org.
The specific error I got was: uninitialized constant Psych::Syck (NameError) when doing bundle install.
This happened when installing simplecov (awesome code coverage tool) version 0.5.0. Working in Ubuntu 11.04 and using RVM.
Fixed the issue with gem update --system
This updates rubygems and produced the following output:
Updating rubygems-update
Fetching: rubygems-update-1.8.10.gem (100%)
Successfully installed rubygems-update-1.8.10
Installing RubyGems 1.8.10
RubyGems 1.8.10 installed
== 1.8.10 / 2011-08-25
RubyGems 1.8.10 contains a security fix that prevents malicious gems from
executing code when their specification is loaded. See
https://github.com/rubygems/rubygems/pull/165 for details.
* 5 bug fixes:
* RubyGems escapes strings in ruby-format specs using #dump instead of #to_s
and %q to prevent code injection. Issue #165 by Postmodern
* RubyGems attempt to activate the psych gem now to obtain bugfixes from
psych.
* Gem.dir has been restored to the front of Gem.path. Fixes remaining
problem with Issue #115
* Fixed Syck DefaultKey infecting ruby-format specifications.
* `gem uninstall a b` no longer stops if gem "a" is not installed.
------------------------------------------------------------------------------
RubyGems installed the following executables:
/home/baller/.rvm/rubies/ruby-1.9.2-p180/bin/gem
RubyGems system software updated
Seems to be a problem with Syck. See here:
Rails 3.1 on Ubuntu 11.04 via RVM - uninitialized constant Psych::Syck
Here:
http://rubyforge.org/tracker/?group_id=126&atid=575&func=detail&aid=29163
And fixes suggested here:
https://github.com/rubygems/rubygems/pull/57
The solution would be to run the below command in your terminal:
gem update --system
It is a bug in the system gem version that causes this issue. This worked for me.

Resources