我正在使用OCRA从我的ruby文件制作exe。 .exe创建没有任何错误,但是当我尝试启动它时,我得到了这个:
C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `chdir': ERROR: Failed to build gem native extension. (Gem::Ext::BuildError)
No such file or directory @ dir_chdir - C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/gems/2.1.0/gems/json-1.8.2/ext/json/ext/generator
Gem files will remain installed in C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/gems/2.1.0/gems/json-1.8.2 for inspection.
Results logged to C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/gems/2.1.0/extensions/x86-mingw32/2.1.0/json-1.8.2/gem_make.out
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/ext/builder.rb:160:in `block in build_extension'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `synchronize'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/ext/builder.rb:159:in `build_extension'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/ext/builder.rb:198:in `block in build_extensions'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `each'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/ext/builder.rb:195:in `build_extensions'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/specification.rb:1436:in `block in build_extensions'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/user_interaction.rb:45:in `use_ui'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/specification.rb:1434:in `build_extensions'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/stub_specification.rb:60:in `build_extensions'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/basic_specification.rb:56:in `contains_requirable_file?'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/specification.rb:925:in `block in find_inactive_by_path'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/specification.rb:924:in `each'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/specification.rb:924:in `find_inactive_by_path'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems.rb:185:in `try_activate'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:132:in `rescue in require'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:144:in `require'
from filename.rb:1:in `<top (required)>'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/src/runThemAll.rb:3:in `load'
from C:/Users/XX/AppData/Local/Temp/ocr81CD.tmp/src/runThemAll.rb:3:in `<main>'
所以,你可以看到我对文件有正确的问题,但我不知道哪些文件。 另外,我在我的exe文件中包含的一个文件(filename.rb)中有一个问题,但是当我单独启动它时,这个文件运行得很好......
所以我真的不明白这里的问题是什么。 我在Windows 7上使用ruby 2.1。
如果你能给我一个关于此的提示,我将非常感激!
编辑代码
runThemAll.rb
$:.unshift File.dirname($0)
load 'filename.rb'
load 'filename2.rb'
require 'securerandom'
filename1.rb
require 'Watir'
require 'csv'
require 'mechanize'
#here some code
filname2.rb
require 'Watir'
require 'csv'
require 'mechanize'
#here some code too
我用来制作exe的命令行:
ocra runThemAll.rb