When I try the following, after installing Ruby 3.0 from snap on Ubuntu 18.04::
gem install rails
I get this error:
/snap/ruby/201/lib/ruby/3.0.0/x86_64-linux/rbconfig.rb:13:in `<module:RbConfig>': ruby lib version (3.0.0) doesn't match executable version (2.5.1) (RuntimeError)
It was right after using
rails new rest-api-messages --api --database=postgresql
and trying to install PostGRES
gem install pg -v '1.2.3' --source 'https://rubygems.org/'
How could I solve this? is Ruby on Rails only for version 2.5.1 and lower?
edit: Then I got
Can't find the 'libpq-fe.h header when trying to install pg gem
Solved with
sudo apt-get install libpq-dev
Duplicate from Can't find the 'libpq-fe.h header when trying to install pg gem
My guess is you already had Ruby 2.5 installed and they are stepping on each other. Ruby versions don't overwrite each other. You need to uninstall Ruby 3.0 and 2.5 and install a Ruby version manager then install Ruby using it. This will also give you a path to move forward easily. Check out Ruby version manager like rbenv or RVM. Take a look at both. For what it's worth. I have used both and finally settled on rbenv.
Related
I've tried to find a way to install freetds on windows, but i just cannot find that.
I'm trying to install tiny_tds but i got the error:
gem install tiny_tds
ERROR: Error installing tiny_tds:
The last version of tiny_tds (>= 0) to support your Ruby & RubyGems was
2.1.1. Try installing it with gem install tiny_tds -v 2.1.1
tiny_tds requires Ruby version < 2.5, >= 2.0. The current ruby version is 2.5.0.
I've tried 'gem install tiny_tds -v 2.1.1', same error.
My ruby version is ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
I asked for my friend try to use my project on his machine(MAC) and he got the same error. So he just installed FreeTds and after that he could install tiny_tds.
I thought the gem Tiny_tds includes Freetds, but it is not happening. I believe i need to install FreeTds on windows.
Could someone explain how to install FreeTds on Windows? which tool is necessary? if it is command lines, which command should i use? Something complete.
It looks like TinyTDS requires an earlier version of Ruby than you have, lower than 2.5. You are running greater than 2.5, version 2.5.1p57.
I'd recommend installing the latest Ruby version of the 2.4 release and trying again. Good luck!
PS: If you need to install the FreeTDS Windows binaries directly, you can find them here: https://sourceforge.net/projects/freetdswindows/
After installing pik and changing my Ruby version to 2.0.0, bundler no long works properly
C:\Users\Me\Documents\Work Projects\Application>bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.0)
Installing atomic (1.1.14)
Gem::InstallError: The 'atomic' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing atomic (1.1.14), and Bundler cannot continue.
Make sure that `gem install atomic -v '1.1.14'` succeeds before bundling.
Installing the devkit from Ruby Installer sort of defeats the reason why I went to the trouble of installing pik. How can I fix this, so that in the future, I can easily update ruby using pik and still have everything working?
I had the same problem - if you follow the instructions listed (ie installing devkit and following their directions [they don't actually tell you to use rubyinstaller]), you'll be fine. Also make sure that during the init phase of the Devkit instructions that it doesn't miss any of your ruby installations.
A note though, it seems that pik can't specify the x64 version of 2.0.0, so you may run into problems if that's the case. In the end I had to use the rubyinstaller for the x64 version of ruby, and then ran the x64 version of the devkit.
Hope this helps.
I think Josh' answer is probably right, but I actually installed Ubuntu as a VM in the end, just so I could use RVM.
RVM is a thousand times better than Pik, and it installs the DevKit. It's so good it's genuinely worth installing Ubuntu just so you can use it.
I can install the linecache (0.46) gem against ruby v 1.8.x, but not 2.0.0. When I run bundle install, I want to specify that I want to install all gems against 2.0.0 except linecache, which I want to install against 2.0.0. How can I do that?
I ended up just installing using an older version of ruby for all the gems. I used rvm use "ree-1.8.7-2012.02" and bundle install, and that worked.
I just installed ruby 2 on MacMountainLion, how to install gems? Actually I have both installed but there is something wrong. Maybe a fresh installation would solve.
macbook:~m$ gem install rails
ERROR: Loading command: install (LoadError)
cannot load such file -- openssl
ERROR: While executing gem ... (NoMethodError)
undefined method `invoke_with_build_args' for nil:NilClass
macbook:~ m$ ruby -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.2.0]
macbook:~ m$ gem -v
2.0.3
macbook:~ m$
I had the same problem, but fixed it as follows:
Apparently OS X Mountain Lion has an older version of OpenSSL than Ruby 2 will tolerate. Download and install the latest OpenSSL using ./Configure darwin64-x86_64-cc --prefix=/usr/local --openssldir=/usr/local/openssl; make; sudo make install. Then build Ruby using ./configure --with-openssl-dir=/usr/local/openssl; make; sudo make install. Ruby's configure complains that --with-openssl-dir is an unknown option, but the build apparently uses it anyway because anything that depends on SSL, including gem installs, now works.
Installing gem like rails needs lot of dependent libraries which you have to download and install it manually
Alternatively you can try using Homebrew to install all the dependent libraries. If you are new to ROR development I strongly recommend you to use rvm to manage different versions of ruby
Once you have installed all the necessary dependent libraries using Homebrew then Its fairly straight forward to install a gem, execute the following after replacing "gemname" with the gem you are interested in
gem install <<gemname>>
I've installed a instantrail2.0. I want to install watir 1.65
First I installed watir-1.6.5.gem it said 302 fetching http://gems.r....
then I downlord a rubygems-update-1.3.7.gem and type
gem install --local rubygems-update-1.3.7.gem
successfully installed.
then I type in update_rubygems
next I type in gem install watir-1.6.5.gem
but it appears ERROR:Failed to build gem native extension
I searched and found an answer that 1.3.7 doesn't support win32.
then I type
gem install sqlite3-ruby -v 1.3.0 gem install watir-1.6.5.gem
ERROR:Failed to build gem native extension
gem install sqlite3-ruby -v 1.2.3 gem install watir-1.6.5.gem
ERROR:Failed to build gem native extension
How can I do next??
use a more current version of Watir
I second Zeljko, going with the latest versions of rubygems and watir totally makes sense. If you must stick to older gems, try installing Ruby DevKit and then do the gem install to see if that helps.
What version of Ruby are you using? You should be using Ruby 1.8.6 with that version of Watir. I am also wondering if part of your problem is that you are doing a local install, instead of installing from internet. Local installs of Watir are difficult because of all of its dependencies.