本文介绍了Ruby和Rails gem的安装问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为模块和课程学习Rails on Rails,并按照教程进行学习.当我尝试安装这样的gem时:gem simple-navigation(或gem"simple-navigation")我收到此错误

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

所有宝石都会发生这种情况. gem install简单导航有效,但是当我运行捆绑安装时不会安装.我必须手动将其添加到gemfile才能使其正常工作.

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.

有人知道为什么会这样吗?使用Ruby 2.00和Rails 4

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

推荐答案

这是预期的行为. gem install simple-navigation将正常工作以为 ruby​​ 安装gem,但是要为 rails 应用程序安装gem,则需要将gem添加到Gemfile中,然后运行bundle install,而不是只运行gem install命令.

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 simple-navigation而收到发布的错误,这不是命令.

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

这篇关于Ruby和Rails gem的安装问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 05:36