所以我是一个新手(嘿,至少我发现了堆栈溢出,对吧?)并且我正在使用 Michael Hartl 的 Ruby on Rails Tut。第三章有我的输入:
sudo rails generate controller StaticPages home help
我回来了:
Could not find nokogiri-1.6.7.1 in any of the sources
Run `bundle install` to install missing gems.
当我查看捆绑安装程序时,它肯定列出了 nokogiri 1.6.7.1 当我输入时:
bundle show nokogiri
我得到:
/Users/user/.rvm/gems/ruby-2.2.3@rails3tutorial2ndEd/gems/nokogiri-1.6.7.1
我在我的 macbook pro os x el Capitan v 10.11.1 上使用 Rails v 4.2.5
非常感谢任何帮助。也许我可以在一两年后还清它!
最佳答案
Bundler 是一个确保运行时环境使用正确的库和版本的工具。通常,我们会在前面添加命令来进行 Ruby 开发,包括 Rails:
bundle exec rails generate controller StaticPages home help
bundle exec
接受命令及其参数,并将其运行到同一文件夹中 Gemfile
中定义的环境中。
正如 @David Grayson 提到的,sudo
改变了环境。为了代码的安全性和打包,最好以当前用户身份运行(并避免部署团队的愤怒)。
关于ruby-on-rails - 在任何来源中均找不到 nokogiri-1.6.7.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34644993/