简体   繁体   English

Ruby和Rails gem安装问题

[英]Ruby and Rails gem install issues

Im learning ruby on rails for a module and class and following a tutorial. 我正在轨道上学习ruby以获得模块和课程并遵循教程。 When I try to install a gem like this: gem simple-navigation (or gem "simple-navigation") I get this error 当我尝试安装这样的宝石时:gem simple-navigation(或gem“simple-navigation”)我收到此错误

ERROR while executing gem ... (Gem:CommandLineError) 执行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. gem install简单导航工作,但是当我运行bundle install时没有安装。 I have to manually add it to the gemfile to get it to work. 我必须手动将它添加到gemfile才能使它工作。

Anyone know why this is happening? 任何人都知道为什么会这样吗? Using Ruby 2.00 and Rails 4 使用Ruby 2.00和Rails 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. gem install simple-navigation可以正常工作为ruby安装gem,但是要为rails应用程序安装gem,你需要将gem添加到你的Gemfile然后运行bundle install而不是只运行gem install命令。

You are getting the error you posted because you are running gem simple-navigation , and that is not a command. 您收到错误,因为您正在运行gem simple-navigation ,这不是命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM