5

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

4

1 回答 1

4

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.

于 2013-10-27T18:34:06.697 回答