您好我已经构建了一个CLI Ruby gem。
如果我尝试通过git repo运行它,它的工作原理非常好。但是,如果我尝试安装一个gem并运行它,它会给我一个错误,找不到命令。
错误讯息..
popular_deals
-su: popular_deals: command not found
我的一位朋友也尝试过,他收到了此错误消息
WARN: Unresolved specs during Gem::Specification.reset:
colorize (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/Users/M/.rvm/gems/ruby-2.2.3/gems/popular_deals-0.2.0/bin/popular-deals:3:in `require': cannot load such file -- popular_deals (LoadError)
from /Users/M/.rvm/gems/ruby-2.2.3/gems/popular_deals-0.2.0/bin/popular-deals:3:in `<top (required)>'
from /Users/M/.rvm/gems/ruby-2.2.3/bin/popular-deals:23:in `load'
from /Users/M/.rvm/gems/ruby-2.2.3/bin/popular-deals:23:in `<main>'
from /Users/M/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
from /Users/M/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
这是我宝石的链接..
https://rubygems.org/gems/popular_deals
这是github repo的链接..
https://github.com/HimaChitalia/popular-deals-from-slickdeals.net-cli
有什么建议吗?非常感谢您的帮助!
答案 0 :(得分:2)
通过执行以下操作,我能够让它工作。我认为,在您的原始答案中,当命令实际为popular_deals
并且与宝石的名称不同时,您正在执行popular-deals
!
mkdir deals_test
cd deals_test
# Contents shown below
touch Gemfile
bundle
bundle exec popular-deals
的Gemfile:
source 'https://rubygems.org'
gem 'popular_deals'
我使用MRI 2.3.3