Ruby and Rails gem install issues

北城以北 提交于 2019-12-10 15:37:58

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/19621794/ruby-and-rails-gem-install-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!