FEE
FEE

Reputation: 309

Built a gem but when tried it gives an error that command not found

Hi I have built a CLI Ruby gem.

If i try to run it through git repo, it works perfectly fine. But if I try to install a gem and run it, it gives me an error that command not found.

Error message..

 popular_deals                                                                                                                                                          
-su: popular_deals: command not found

A friend of mine also tried, he got this error message

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>' 

Here is a link of my gem..

https://rubygems.org/gems/popular_deals

Here is a link of github repo..

https://github.com/HimaChitalia/popular-deals-from-slickdeals.net-cli

Any suggestions? Thanks a lot for help!

Upvotes: 0

Views: 241

Answers (1)

David S.
David S.

Reputation: 730

I was able to get it to work by doing the following. I think that in your original answer you were executing popular_deals, when the command is actually popular-deals and not the same as the name of the gem!

mkdir deals_test
cd deals_test
# Contents shown below
touch Gemfile
bundle
bundle exec popular-deals

Gemfile:

source 'https://rubygems.org'

gem 'popular_deals'

I'm using MRI 2.3.3

Upvotes: 2

Related Questions