pik Error: private method `gsub' called for ni

2019-05-09 00:39发布

问题:

I´m getting an error when adding JRuby 1.3.1 to pik. Error:

Error: private method `gsub' called for nil:NilClass

this is my path environment variable:

C:\Users\Owner>echo %path%
C:\Program Files\Java\jdk1.7.0_05\bin;c:\jruby-1.7.0.preview1\bin;C:\jruby-1.3.1\bin;c:\pik

this is when trying to add 1.3.1 version:

C:\Users\Owner>pik add C:\jruby-1.3.1\bin

There was an error.
 Error: private method `gsub' called for nil:NilClass

  in: pik/commands/command.rb:124:in `get_version'
  in: pik/commands/add_command.rb:23:in `add'
  in: pik/commands/add_command.rb:13:in `execute'
  in: pik_runner:33

It´s not the case when adding JRuby 1.7.0 version.

I have added JRuby 1.3.1 before to pik, but I don´t know what might be causing this error this time. Any ideas?

回答1:

I run the command pik run PATH with this result:

C:\Users\Owner>pik run PATH
Cannot locate Java installation, specified by JAVA_HOME:
C:\Program Files\Java\jdk1.7.0_05\**bin**

So added to environment variables -> User variables

JAVA_HOME C:\Program Files\Java\jdk1.7.0_05

Now JRuby 131 has been added to my pik.

Regards