Forum: Ruby on Rails The error occurred while evaluating nil.chop

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E043591126e359a2ea611270eba51d4b?d=identicon&s=25 Yasir (Guest)
on 2009-06-03 09:03
(Received via mailing list)
Hi,

I am new to Ruby, while running a project I get the following errors:

C:\cairns\cairns\cairns\script>ruby server
=> Booting WEBrick...
server: No such file or directory - uname
C:/cairns/cairns/cairns/app/models/node.rb:74:in `get_hostname': You
have a nil
object when you didn't expect it! (NoMethodError)
The error occurred while evaluating nil.chop
        from C:/cairns/cairns/cairns/app/models/node.rb:60:in
`initialize'
        from ./../config/../config/environment.rb:65:in `new'
        from ./../config/../config/environment.rb:65
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `ge
m_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `re
quire'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
active_suppo
rt/dependencies.rb:495:in `require'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
active_suppo
rt/dependencies.rb:342:in `new_constants_in'
        from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
active_suppo
rt/dependencies.rb:495:in `require'
         ... 6 levels...
        from C:/Ruby/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/commands/
server.rb:3
9
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `ge
m_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `re
quire'
        from server:3


Need Help!


Kind Regards,
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2009-06-03 16:57
(Received via mailing list)
Don't cd into the script dir, instead call it from the project root:

ruby script/server
D69d23d8e811e8ab2a8593380d6ede63?d=identicon&s=25 Jeff Emminger (jemminger)
on 2009-06-03 16:59
(Received via mailing list)
On Jun 3, 10:56 am, jemminger <jemmin...@gmail.com> wrote:
> Don't cd into the script dir, instead call it from the project root:
>
> ruby script/server
>

Actually that doesn't seem to matter - the problem is that you're
trying to call chop() on nil here:

C:/cairns/cairns/cairns/app/models/node.rb:60:in `initialize'
885ac43bca92fc2b1034356f3283e788?d=identicon&s=25 pharrington (Guest)
on 2009-06-03 17:45
(Received via mailing list)
Also, if you're trying to get the machine's hostname, instead of
invoking the shell to call uname or hostname or whatever, just use
Socket.gethostname.
This topic is locked and can not be replied to.