# Script/generate not working ! while rails do

**URL:** <https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485>\
**Category:** Rails\
**Created:** [January 12, 2010, 5:40pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485 "2010-01-12T17:40:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 12, 2010, 5:40pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/1 "2010-01-12T17:40:56Z")

</div>

Hi  
Strange thing happens when i run rails project it makes project but when  
i run script/generate or script/server it writes

Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update  
your RAILS\_GEM\_VERSION setting in config/environment.rb for the Rails  
version you do have installed, or comment out RAILS\_GEM\_VERSION to use  
the latest version installed.

so rails -v gives Rails 2.3.5

How to fix that kind of problem ? i use mac and my “gem environment” is

RubyGems Environment:

- RUBYGEMS VERSION: 1.3.5
- RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114)  
[universal-darwin9.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE:  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
  - ruby
  - universal-darwin-9

- GEM PATHS:
  - /Library/Ruby/Gems/1.8
  - /Users/boris/.gem/ruby/1.8
  - 

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

- GEM CONFIGURATION:
  - :update\_sources =\> true
  - :verbose =\> true
  - :benchmark =\> false
  - :backtrace =\> false
  - :bulk\_threshold =\> 1000

- REMOTE SOURCES:
  - [http://gems.rubyforge.org/](http://gems.rubyforge.org/)

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 12, 2010, 6:09pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/2 "2010-01-12T18:09:28Z")

</div>

What does the environment.rb show as the rails version?

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 12, 2010, 6:52pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/3 "2010-01-12T18:52:22Z")

</div>

Chris H. wrote:

> What does the environment.rb show as the rails version?

# Specifies gem version of Rails to use when vendor/rails is not present

RAILS\_GEM\_VERSION = ‘2.3.5’ unless defined? RAILS\_GEM\_VERSION

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 12, 2010, 9:57pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/4 "2010-01-12T21:57:47Z")

</div>

This happened to me yesterday too.

Weird, did you install any gems before that? I had a couple gems  
installed I  
think that something broke up that =/

[]'s  
Rodrigo D.

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 12, 2010, 10:15pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/5 "2010-01-12T22:15:57Z")

</div>

2010/1/12 Boris B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Hi  
> Strange thing happens when i run rails project it makes project but when  
> i run script/generate or script/server it writes
> 
> Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update  
> your RAILS\_GEM\_VERSION setting in config/environment.rb for the Rails  
> version you do have installed, or comment out RAILS\_GEM\_VERSION to use  
> the latest version installed.
> 
> so rails -v gives Rails 2.3.5

I can’t help much not being a mac man, but I believe that this can  
happen if rails is installed twice in different places. Google for  
‘missing the rails gem’ might help.

Colin

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 13, 2010, 12:51pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/6 "2010-01-13T12:51:07Z")

</div>

Colin L. wrote:

> 2010/1/12 Boris B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):
> 
> > Hi  
> > Strange thing happens when i run rails project it makes project but when  
> > i run script/generate or script/server it writes
> > 
> > Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update  
> > your RAILS\_GEM\_VERSION setting in config/environment.rb for the Rails  
> > version you do have installed, or comment out RAILS\_GEM\_VERSION to use  
> > the latest version installed.
> > 
> > so rails -v gives Rails 2.3.5
> 
> I can’t help much not being a mac man, but I believe that this can  
> happen if rails is installed twice in different places. Google for  
> ‘missing the rails gem’ might help.
> 
> Colin

Exactly, i have 1.2.3 1.2.6 installed to  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8  
and 2.3.5 version here  
/Library/Ruby/Gems/1.8

don’t know what default is - i guess it’s /Library/Ruby/Gems/1.8

i removed files from that directory  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8  
but it didn’t help.  
So in file “server” (script/server) we have 2 lines of code

#!/usr/bin/env ruby  
require File.expand\_path(‘…/…/config/boot’, **FILE** )  
require ‘commands/server’

first line load boot file and in booot file we have that line that loads  
gems

class GemBoot \< Boot  
def load\_initializer  
self.class.load\_rubygems  
load\_rails\_gem  
require ‘initializer’  
end

```
def load_rails_gem
  if version = self.class.gem_version
    gem 'rails', version
  else
    gem 'rails'
  end
rescue Gem::LoadError => load_error
  $stderr.puts %(Missing the Rails #{version} gem. Please `gem 

```

install -v=#{version} rails`, update your RAILS\_GEM\_$  
exit 1  
end

i am not an expert in ruby so far but i guess this function returns  
false  
“load\_rails\_gem” and this expression returns false “gem ‘rails’” so it’s  
a gem method but what it’s doing ?

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 13, 2010, 5:55pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/7 "2010-01-13T17:55:57Z")

</div>

On Jan 12, 11:40Â am, Boris B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How to fix that kind of problem ? i use mac and my “gem environment” is

Can you post the output of ‘gem list --local’? I’m guessing that  
you’re missing one of the dependencies somehow.

–Matt J.

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 13, 2010, 10:35pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/8 "2010-01-13T22:35:02Z")

</div>

Matt J. wrote:

> On Jan 12, 11:40Â am, Boris B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > How to fix that kind of problem ? i use mac and my “gem environment” is
> 
> Can you post the output of ‘gem list --local’? I’m guessing that  
> you’re missing one of the dependencies somehow.
> 
> –Matt J.

gem list --local

\*\*\* LOCAL GEMS \*\*\*

actionmailer (2.3.5, 1.3.6, 1.3.3)  
actionpack (2.3.5, 1.13.6, 1.13.3)  
actionwebservice (1.2.6, 1.2.3)  
activerecord (2.3.5, 1.15.6, 1.15.3)  
activeresource (2.3.5)  
activesupport (2.3.5, 1.4.4, 1.4.2)  
acts\_as\_ferret (0.4.4, 0.4.1)  
capistrano (2.5.13, 2.0.0)  
cgi\_multipart\_eof\_fix (2.5.0, 2.2)  
daemons (1.0.10, 1.0.9, 1.0.7)  
dnssd (1.3.1, 0.6.0)  
fastthread (1.0.7, 1.0.1, 1.0)  
fcgi (0.8.8, 0.8.7)  
ferret (0.11.6, 0.11.4)  
gem\_plugin (0.2.3, 0.2.2)  
git (1.2.5)  
highline (1.5.1, 1.2.9)  
hpricot (0.8.2, 0.6)  
libxml-ruby (0.3.8.4)  
mongrel (1.1.4, 1.0.1)  
needle (1.3.0)  
net-scp (1.0.2)  
net-sftp (2.0.4, 1.1.0)  
net-ssh (2.0.17, 1.1.2)  
net-ssh-gateway (1.0.1)  
rack (1.0.1)  
rails (2.3.5, 1.2.6, 1.2.3)  
rake (0.8.7, 0.7.3)  
RedCloth (4.2.2, 3.0.4)  
ruby-openid (1.1.4)  
ruby-yadis (0.3.4)  
rubygems-update (1.3.5)  
rubynode (0.1.3)  
sources (0.0.1)  
sqlite3-ruby (1.2.1)  
termios (0.9.4)

gem dependency rails  
Gem rails-1.2.3  
rake (\>= 0.7.2, runtime)  
activesupport (= 1.4.2, runtime)  
activerecord (= 1.15.3, runtime)  
actionpack (= 1.13.3, runtime)  
actionmailer (= 1.3.3, runtime)  
actionwebservice (= 1.2.3, runtime)

Gem rails-1.2.6  
rake (\>= 0.7.2, runtime)  
activesupport (= 1.4.4, runtime)  
activerecord (= 1.15.6, runtime)  
actionpack (= 1.13.6, runtime)  
actionmailer (= 1.3.6, runtime)  
actionwebservice (= 1.2.6, runtime)

Gem rails-2.3.5  
rake (\>= 0.8.3, runtime)  
activesupport (= 2.3.5, runtime)  
activerecord (= 2.3.5, runtime)  
actionpack (= 2.3.5, runtime)  
actionmailer (= 2.3.5, runtime)  
activeresource (= 2.3.5, runtime)

---

<div class="post-metadata">

**Author:** ![fell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/bbce88/32.png) [@fell](https://www.ruby-forum.com/u/fell)\
**Post date:** [January 14, 2010, 2:27pm UTC](https://www.ruby-forum.com/t/script-generate-not-working-while-rails-do/181485/9 "2010-01-14T14:27:29Z")

</div>

On Jan 13, 4:35Â pm, Boris B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> gem list --local
> 
> \*\*\* LOCAL GEMS \*\*\*

[snip]

Well, that was a wash. I don’t see anything missing on the list; as  
others have noted, do you happen to have a second Ruby installed? Try  
running ‘/usr/bin/env ruby’.

–Matt J.
