I'm installing Ruby on Windows 10.
I already installed Ruby 2.3
When I tried to install Rails 4.2.6 I had problems with nokogiri.
Thanks to this questions and answers I was able to solve by installing nokogiri version 1.6.6.4 then rails then version 1.6.8.rc3 like this:
gem install nokogiri -v '1.6.6.4'
gem install rails
gem install nokogiri -v '1.6.8.rc3'
But after that, I'm supposed to include this:
gem 'nokogiri', '>=1.6.8.rc3'
in gemfile.
When asked, the guys says:
Hey, guys, just add gem 'nokogiri', '>=1.6.8.rc3 in your Rails
application Gemfile (outside of the development, test, production
group) and run bundle update nokogiri.
But I'm not sure where is the Rails application gemfile or which file should I edit.
From this previous question I can see how the file content is but there isnt much explanation about where do I find it.
I'm about to take a tutorial in Ruby o Rails, so I'm below noob, and the first page tutorial is about installing Ruby and Rails, it's supposed to install easy except for the nokigiri problem (only a Windows problem it seems).
The Gemfile is typically located in the root of your project and is called just that Gemfile.
Don't change the Gemfile.lock file it is written automatically.
You can find a file with name 'Gemfile' at the root of your rails application.
"The Rails application gemfile" is the file called Gemfile, in the root of your project.
You have already pasted the contents of this file in your previous question.
Related
I know the question to this is probably very straight forward, but Im a bit new to rails, so please bear with me. I have had rails version 5.1.5 on my Mac and I need to update rails to version 5.1.6 and I'm not able for the life of me to do that.
I tried
`sudo gem install rails -v 5.1.6`
but this gives the error
ERROR: Failed to build gem native extension.
Using gem list gives that I have
rails (5.1.5, 5.1.4)
I also tried bundle update rails
I keep getting Could not locate Gemfile
What am I doing wrong??
gem is the native package manager for Ruby.
Bundler (bundle) is a gem to manage bundles of gems via a Gemfile.
I recommend you use a version manager for Ruby like rvm, rbenv or chruby and also install xcode and the commandline-tools package of xcode. Some gems have dependencies written in C that need to be configured and compiled, all of that and some more comes with xcode.
I currently have Ruby 2.2.6 and Rails 5.0.1 installed on my Windows 10 machine. I have cloned an existing project that has the following settings included in its Gemfile:
# Lock-in Lang and Framework:
ruby '2.2.0'
gem 'rails', '4.2.0'
I'm having a surprisingly hard time figuring out how to get Ruby 2.2.0 and Rails 4.2.0 installed. Ruby has good documentation of different installation options, but I think I've exhausted the Windows options without any success. Here are a couple I tried:
Installers: I couldn't find an option for downloading either from RailsInstaller, RubyInstaller, and Bitnami.
RVM: I tried (unsuccessfully) following this blog post to install cygwin so that I could use RVM, but then saw in the comments that the author now recommends spinning up a linux VM rather that using this method.
Pik and Uru: It appears Pik is no longer maintained, and I couldn't figure how to download new versions and ruby and rails with Uru as opposed to managing already downloaded versions.
EDIT: I also tried simply changing the version numbers for ruby and rails in the Gemfile to 2.2.6 and 5.0.1. When I do this I (very understandably) get a message when I try to use a rails command saying I need to run bundle update rails. When I run that rails update I get the following error: Bundler could not find compatible versions for gem "rack". I've done some googling on that option, and it looks like resolving that issue might be possible but requires some more involved tinkering with my Gemfile configuration.
I think my next option is to install Ruby from the source, but I wanted to throw a question up here first to make sure I'm not missing an easier method. So my question is - is it really this hard to get an older minor release of ruby and rails installed on Windows? I realize that the majority of users are probably looking for the most recent release, but it doesn't seem to me that my use case is terribly unique.
The oldest available Ruby 2.2.x via RubyInstaller is 2.2.1
So, the answer to your question is, "Yes, you'll have to build from source."
But then again,
v2.x of gem "rack" requires at least Ruby v2.2.2
And depending on what other gems are included in your Gemfile, you'll still have to reconfigure your Gemfile to get this app running.
So the best solution is probably to use the latest patch version of Ruby 2.2.x and lock rails to 4.2.x. (The app may not be compatible with Rails 5.x)
# Lock-in Lang and Framework:
ruby '2.2.6'
gem 'rails', '~> 4.2'
Then run bundle install to install all the gems required by the Gemfile
I have updated all of my gems, including to Rails 3.2.8, prior to a new deployment. However, my application is now broken because something is trying to install gem "termios" version 0.9.4.
Apparently, 0.9.4 does not work on any computer or server I own. There are some newer versions, 0.9.6 specifically, but they are not posted in wherever bundler looks for gems.
There are some version on Github, but they have been mysteriously renamed "ruby-termios". Well, some gem in my Gemfile is not looking for ruby-termios. It's looking for termios. Failure.
How can I find out which gem is trying to install this so I can see if it can be whacked?
Check your Gemfile.lock - it has all the gems and their dependencies listed in it. As long as you've been able to install these gems in the past, you'll be able to tell where that dependency is coming from.
The gem command will dump out the tree of dependencies for you.
$ gem dependency
Or if you want to check just a specific gem.
$ gem dependency foo
I am newbie to Rails development and working with Spree Commerce bitnami Stack VM instance. I am trying to install spree extension and the instructions says to make configuration changes to application Gem file which I cannot find in the webserver directory
Running Rails 2.3.5
Spree 0.9.4 version
The reason why you can't find it because Gemfile is a standard from Rails 3+ and you're using a Rails2 app. Rails3 uses Bundler which takes cares about all Gems for your app.
In Rails 2 gem dependency definition is different. It doesn't have Bundler so "bundle install" also won't work in your case.
Instead you need to add Gem dependency to config/environment.rb like this:
config.gem 'your_gem_name_here'
also you need to install the Gem manually, so not like in Rails3 where Bundler installs it. Use this in shell:
gem install your_gem_name
In general it's a good idea to update the app to Rails3, I'd recommend it because as I saw this Gem you wanna use doesn't have earlier release.
I'm a newbie to Ruby on Rails. I had a quick question about installing gems.
I'm using a windows 7 64 bit machine with Ruby 1.9.2 and Rails 3.0 and I'm trying to install the gravatar_image_tag gem.
gem install gravatar_image_tag
After I run that it says its succcessful. But when I try to do this:
gravatar_image_tag -v
It says that 'gravatar_image_tag' is not recognized as an internal or external command, operable program or batch file'
When i looked into my ruby192/bin file there are batch files for rails, annotate etc etc that work fine but there's not batch file for gravatar_image_tag.
I was wondering where I'm going wrong with this.
Thanks in advance.
Not all gems are executable from the command line. The best way to see if a gem is installed (as well as its version) is to run:
gem list
If you want to use a gem inside your rails 3 project, you should add it to your Gemfile (in the root of your project). Something like this
gem "gravatar_image_tag"
then run bundle install.
The gravatar_image_tag should placed somewhere in your view, to generate the correct html.
More information can be found on their github page.
[EDIT] Maybe my answer was not too the point. To check if the gem was correctly installed, you either type
gem list gravatar_image_tag
or
bundle show gravatar_image_tag
if you installed the gem using bundler.
Not all gems install a batch-file, and according to the documentation this doesn't either.