I installed rails a while back.
Now when I do rails new foo at the terminal nothing happens.
I have ruby 1.9.2. When I do gem list, I can see rails (3.2.8). However executing any rails commands, including rails itself does nothing.
I also tried sudo gem cleanup and sudo gem clean. sudo gem uninstall rails and then sudo gem install rails. This gives me
Fetching: rails-3.2.8.gem (100%)
Successfully installed rails-3.2.8
1 gem installed
Installing ri documentation for rails-3.2.8...
file 'lib' not found
Installing RDoc documentation for rails-3.2.8...
file 'lib' not found
Any help would be appreciated.
Edit: The problem was that I had defined a shell alias called rails which was masking rails.
Do gem install rails - no sudo
Then rails new foo
Related
Can somebody point me to how I can install the ri documentation for v2.1.7?
I tried "How do I install the Ruby ri documentation?" with no luck.
I would prefer installing ri so that I can lookup specific methods in a class directly without opening the help file.
Also, I had no luck with the following:
C:\Users\ram\ruby>gem install rdoc-data
Fetching: rdoc-data-4.0.1.gem (100%)
rdoc-data is only required for C ruby 1.8.7 or 1.9.1.
rdoc-data is required for JRuby.
To install ri data for RDoc 4.0+ run:
rdoc-data --install
Successfully installed rdoc-data-4.0.1
Parsing documentation for rdoc-data-4.0.1
Installing ri documentation for rdoc-data-4.0.1
Done installing documentation for rdoc-data after 1 seconds
1 gem installed
C:\Users\ram\ruby>ri Array
Nothing known about Array
C:\Users\ram\ruby>rdoc-data --install
Your ruby version 2.1.7 is not supported, only 1.8.7, 1.9.2, 1.9.3, 2.0.0
It seems that for v2.1.7 something else is required.
Note this is for Windows. I want to do it natively without using VM/Cygwin, etc.
As your error message indicates, rdoc-data doesn't support ruby 2.1.7.
If you're using RVM, try:
rvm docs generate
Be patient, it takes several minutes to install the documentation.
If you want the ri documentation installed by default for all gem installations, check your gem config file ~/.gemrc to see if you have defaults set up that excludes documentation. Remove any and all of the following:
install: --no-rdoc --no-ri
update: --no-rdoc --no-ri
install: --no-document
update: --no-document
gem: --no-document
I believe gems install documentation by default. If not, add this to the gem config file
gem: --ri
Since you're on Windows, you can install Cygwin on your Windows machine and then install RVM using Cygwin. Or, you can download the rdocs source files http://ruby-doc.org/downloads/ and extract them to your Ruby docs folder /Users/userprofile/.rvm/gems/ruby-2.1.7/doc/.
I did a cursory glance, and didn't see ruby 2.1.7; it goes straight from 2.1.6 to 2.2.0. You can dump 2.1.6 in the ruby-2.1.7/doc/ folder or update your Ruby version to one that is supported.
I'm getting the below error message when creating a new rails app.
Bundler::GemspecError: Could not read gem at /Users/xyz/.rvm/gems/ruby-2.1.1/cache/rdoc-4.2.0.gem. It >may be corrupted.
An error occurred while installing rdoc (4.2.0), and Bundler cannot continue.
Make sure that gem install rdoc -v '4.2.0' succeeds before bundling.
I am on Ruby 2.1.1 and Rails 4.1.6. I have tried:
gem install rdoc -v '4.2.0'; no change.
gem install rdoc; no change.
gem install rails; no change.
gem install rails --no-ri --no-rdoc; no change.
gem uninstall rails; elect to uninstall all versions.
gem install rails; hangs for a long time on 'installing ri documentation'.
gem uninstall rails; removes the hald installed 4.1.8 vers installed in last cmd.
gem install rails --no-ri --no-rdoc; installs without issue.
rails new new_app_name; exactly the same rdoc error issue even though I specified an install without rdoc!!
Bundler::GemspecError: Could not read gem at /Users/jamesbkemp/.rvm/gems/ruby-2.1.1/cache/rdoc->4.2.0.gem. It may be corrupted.
An error occurred while installing rdoc (4.2.0), and Bundler cannot continue.
Make sure that gem install rdoc -v '4.2.0' succeeds before bundling.
I seem to be stuck on this error, bundle install or update isn't doing anything to help either. Can anyone help?
Just removed the two sited instances of 'gem rdoc' from gemfile.lock, still the same issue.
FYI - Seemed to be an issues with Bundler. Removed bundler and reinstalled and all seemingly ok.
I encountered the problem today and resolved the issue by deleting "rdoc->4.2.0.gem" from the cache folder and after that all you have to do is open command prompt and type gem install rdoc -v '4.2.0' and press enter , it will show a warning that
do you want to overwrite the executable file in bin folder (Y/N).
Type Y and press enter and you are ready for the ride.
I'm not a rubyist and there might be something obvious I'm missing.
I've wrote an application in Ruby 1.8.7, I'm trying to package it in Vagrant (running Raring 13.04), but I've to run "bundle install" to install the requirements and even though gem1.8 does exist, running bundle install still install the gems for Ruby 1.9.3. And then my program fails at runtime...
Any idea about how to solve this?
UPDATE 1
The related Gemfile (thanks to the first answerers):
ruby '1.8.7'
# ...
gem 'trollop'
but for ruby1.8 myfile.rb an error is raised
no such file to load -- trollop (LoadError)
After investigation, the problem looks in bundle install:
Your Ruby version is 1.9.3, but your Gemfile specified 1.8.7
I don't get how to solve the problem.
UPDATE 2
After following the advices from #klaffenboeck things have changed. I'm using RVM and have Ruby 1.8.7 when entering in the project folder. Bundler seems to install things correctly, however the require seems to fail... Path problem?
See here for detail about Vagrant / RVM setup: https://rvm.io/integration/vagrant
UPDATE 3
Problem solved, I was missing a:
require 'rubygems'
before all gems (it worked locally but not in Vagrant).
Bundler will install gems (by default) for whichever Ruby is in your PATH.
Try /usr/bin/env ruby -v or which ruby to figure out which one that is; my guess is you're running bundler with Ruby 1.8.
Adding
ruby '1.8.7'
on top of your Gemfile will help diagnose.
Not aware of this problem in general, but try to put the ruby-version at the top of your gemfile:
#Gemfile
ruby '1.8.7'
# followed by your gems
Edit:
this is most likely because your Gemfile.lock states ruby 1.9.3 - run bundle update
Try running gem uninstall bundler, then gem1.8 install bundler.
Your bundle command seems to be running under Ruby 1.9.3. You can verify which ruby executable bundler is using with head -n 1 $(which bundle). You want it to be ruby1.8.
I want to build passenger-3.0.19 apache2 module on a debian squeeze server. After calling passenger-install-apache2-module as root i get the following error message:
Compiling and installing Apache 2 module...
cd /usr/lib/ruby/gems/1.8/gems/passenger-3.0.19
/usr/bin/ruby1.8 /usr/bin/rake apache2:clean apache2 RELEASE=yes
# /usr/bin/ruby1.8 /usr/bin/rake apache2:clean apache2 RELEASE=yes
rake aborted!
no such file to load -- rubygems/builder
Where is the problem? How can i fix this? Using passenger-install-apache2-module --trace doesn't work (for full stacktrace).
I used the newest passenger version (actually 4.0.0.rc4) from git repository and created a gem. Using this gem worked fine.
git clone https://github.com/FooBarWidget/passenger.git
cd passenger
gem build passenger.gemspec
gem install passenger-*.gem
After that you can build the apache2 plugin using passenger-install-apache2-module.
I had a similar environment (passenger 3.0.9, Ruby 1.8.7) and i solved the problem by downgrading rubygems.
The latest stable RVM will install rubygems v(2+). I downgraded to rubygems v(1.6.2), reinstalled the passenger gem and the problem went away.
in an RVM environment the command is gem update --system 1.6.2
The 1.8.x version of rubygems also works, but it throws too many deprecation warnings on everything you do.
I answered a similar question a few minutes ago, here: Passenger: cannot load such file rubygems/builder
Essentially is an issue with Ruby 2.0. I offer a possible solutions there (extracted from a github comment).
If you're not using Ruby 2.0 then perhaps you need to do: gem install builder
If you are running Ruby 2
Edit the file config/rubber/rubber-passenger.yml and
Change the line
passenger_version: 3.0.19
To
passenger_version: 4.0.35 # works fine with 4.0.35 but you can try a newer version
Remember to check the Ruby version in
config/rubber/rubber-ruby.yml
ruby_version: 2.0.0-p247
Make sure you got zlibc.
sudo apt-get install zlibc zlib1g zlib1g-dev
then reinstall or recompile ruby.
Had exactly the same problem. On Amazon Linux, following worked fine:
gem install passenger && passenger-install-apache2-module
Running 'gem install passenger' added the latest version to the system. Removed the old one too:
#gem list passenger
*** LOCAL GEMS ***
passenger (4.0.10, 3.0.19)
#gem uninstall passenger
Select gem to uninstall:
1. passenger-3.0.19
2. passenger-4.0.10
3. All versions
> 1
Successfully uninstalled passenger-3.0.19
I had the same issue. To resolve this I had to downgrade rubygems package. My configuration was passenger 3.0.2 and rubygems 1.3.7.
I am working on ubuntu and rvm. In any case I tried to use sudo gem (any command) it does not recognize gem as command. In addition if I use gem seperately as:
gem install rails
ERROR: Could not find a valid gem 'rails' (>= 0) in any repository
ERROR: Possible alternatives: rails
I got that error. I cannot see the reason.
rvm version 1.10.3
ruby version 1.8.7
gem version 1.6.7
What is the possible reason behind this?
Re-install all rvm and ruby and the gems, solved my problem.