0

I've the following installed:

  • Ruby version 1.8.7
  • Net::SSH 2.10.0

I get the following error when I run my script:

/usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/session.rb:4:in `require': /usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/key_manager.rb:199: syntax error, unexpected ':', expecting ')' (SyntaxError)
              identity.merge(privkey_file: file)
                                          ^
/usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/key_manager.rb:266: syntax error, unexpected $end, expecting kEND
        from /usr/lib/ruby/site_ruby/1.8/net/ssh/authentication/session.rb:4
        from /usr/lib/ruby/site_ruby/1.8/net/ssh.rb:11:in `require'
        from /usr/lib/ruby/site_ruby/1.8/net/ssh.rb:11
        from test.rb:1:in `require'
        from test.rb:1

Do you know why this error has been thrown?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
  • Thanks. How can I determine which version of net-ssh is compatible with 1.8.7? – developer1990 Jun 26 '15 at 16:25
  • 1
    I've posted an answer. But beware that an old version might contain bugs fixed in newer releases. If it's possible upgrade to at least Ruby 1.9.3. – cremno Jun 26 '15 at 16:28

1 Answers1

0

The net-ssh gem doesn't support 1.8.7 anymore. The posted line uses hash syntax that was added in 1.9 (it's equivalent to :privkey_file => file). According to its README the last version with 1.8 support is 2.5.1. You can install this old version with gem install net-ssh -v 2.5.1 but make sure to remove the newer version you've installed.

cremno
  • 4,672
  • 1
  • 16
  • 27