我试图构建一个.exe来在Windows上执行我的脚本而不安装任何ruby。 我正在使用Ocra,但我有一个堆栈跟踪。
另请注意,有两个文件运行整个sc并且我当前使用RVM,因为我使用RVM,所以我没有做任何sudo gem安装。
第一个文件中使用的宝石:
require 'rubygems'
require 'nokogiri'
require 'open-uri'
require 'colorize'
require 'colorized_string'
第二个文件中使用的宝石:
require 'libnotify'
require './firstfile'
require 'os'
require 'twilio-ruby'
这是Ocra给我的:
>ocra --output test.exe firstfile.rb secondfile.rb
/home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:41:in `relative_path_from': undefined method `path' for "/home/xxxx/.rvm/gems/ruby-head@global":String (NoMethodError)
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:779:in `block in build_exe'
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:762:in `each'
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:762:in `build_exe'
from /home/xxxx/.rvm/gems/ruby-head/gems/ocra-1.3.6/bin/ocra:1177:in `block in <top (required)>'
以下是有关我的rvm和我的红宝石版本的更多信息,这是&#39; rvm info&#39;
的确切输出 system:
uname: "Linux xxxx 4.7.1-1-ARCH #1 SMP PREEMPT Wed Aug 17 08:13:35 CEST 2016 x86_64 GNU/Linux"
system: "arch/libc-2.24/x86_64"
bash: "/usr/bin/bash => GNU bash, version 4.3.46(1)-release (x86_64-unknown-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
updated: "1 day 23 hours 44 minutes 51 seconds ago"
path: "/home/xxxx/.rvm"
ruby:
interpreter: "ruby"
version: "2.4.0dev"
date: "2016-05-20"
platform: "x86_64-linux"
patchlevel: "2016-05-20 trunk 55077"
full_version: "ruby 2.4.0dev (2016-05-20 trunk 55077) [x86_64-linux]"
homes:
gem: "/home/xxxx/.rvm/gems/ruby-head"
ruby: "not set"
binaries:
ruby: "/home/xxxx/.rvm/rubies/ruby-head/bin/ruby"
irb: "/home/xxxx/.rvm/rubies/ruby-head/bin/irb"
gem: "/home/xxxx/.rvm/rubies/ruby-head/bin/gem"
rake: "/home/xxxx/.rvm/gems/ruby-head/bin/rake"
environment:
PATH: "/home/xxxx/.rvm/gems/ruby-head/bin:/home/xxxx/.rvm/gems/ruby-head@global/bin:/home/xxxx/.rvm/rubies/ruby-head/bin:/home/xxxx/.rvm/bin:/usr/bin"
GEM_HOME: "/home/xxxx/.rvm/gems/ruby-head"
GEM_PATH: "/home/xxxx/.rvm/gems/ruby-head:/home/xxxx/.rvm/gems/ruby-head@global"
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
我的脚本解析HTML页面,还必须在文件夹中创建一个文件,写入/读取到此文件,而Libnotify必须设置这个,我不知道如何准确地解释它,但它& #39;某种道路:
Libnotify.icon_dirs << '/home/' + ENV['USER'] + '/Downloads/NotificationIcons/'
所以也许其中一个就是Ocra的相对路径,但我不确定100%这就是为什么我想了解什么相对路径&#39;显式意味着以及为什么我有这个错误的堆栈跟踪。
PS:&#39; xxxx&#39;只是为了隐私!
感谢您提前提供任何帮助我目前只是将我的项目打包到跨平台我现在只是想在Windows上获取它。
如果你需要更多的信息只是要求它,如果我犯了任何错误也要温和,因为这是我在Stack Overflow上提出的第一个问题。