larsch / ocra

One-Click Ruby Application Builder
http://ocra.rubyforge.org/
833 stars 84 forks source link

Unable to convert/build to exe from ruby #161

Open NachisGit opened 4 years ago

NachisGit commented 4 years ago

Hi,

I am new to ruby. I know ocra can convert ruby files to exe but unfortunately I strucked in the error "undefined method `relative_path_from' for nil:NilClass (NoMethodError)".

I am trying to run the command

ocra C:\Ruby27\lib\ruby\gems\2.7.0\gems\anystyle-cli-1.3.0\bin\anystyle.rb --add-all-core

image image image

kurapi commented 4 years ago

I have the same problem

horrace commented 3 years ago

I have the same problem

jmlevesque333 commented 3 years ago

I have run into the same issue with my coworker, he had the issue and I didn't from the same Git repo. It seems to happen because for some odd reason, this: manifests = Host.exec_prefix.find_all_files(/\.manifest$/) finds two manifest files when there is actually only one, and the second one is just nil. So this block:

manifests.each do |manifest|
  Ocra.msg "Adding external manifest #{manifest}"
  target = manifest.relative_path_from(Host.exec_prefix)
  sb.createfile(manifest, target)
end

runs twice, and on the second time fails because manifest is nil giving this log:

=== Adding external manifest C:/Ruby27-x64/bin/ruby_builtin_dlls/ruby_builtin_dlls.manifest
=== Adding external manifest

We have been able to fix it on our side by putting a check next if manifest.nil? at line 930. I would assume reinstalling ruby could do the trick as well.