DTC
DTC

Reputation: 87

Ruby and Rails gem install issues

Im learning ruby on rails for a module and class and following a tutorial. When I try to install a gem like this: gem simple-navigation (or gem "simple-navigation") I get this error

ERROR while executing gem ... (Gem:CommandLineError)

unknown command simple-navigation

This happens with all gems. gem install simple-navigation works, however doesnt install when i run bundle install. I have to manually add it to the gemfile to get it to work.

Anyone know why this is happening? Using Ruby 2.00 and Rails 4

Upvotes: 5

Views: 6409

Answers (1)

jvperrin
jvperrin

Reputation: 3368

This is intended behavior. gem install simple-navigation will work correctly to install a gem for ruby, but to install a gem for your rails application, you need to add the gem to your Gemfile and then run bundle install instead of just running the gem install command.

You are getting the error you posted because you are running gem simple-navigation, and that is not a command.

Upvotes: 4

Related Questions