在任何来源中都找不到 nokogiri-1.6.7.1
Could not find nokogiri-1.6.7.1 in any of the sources
所以我是新手(嘿,至少我发现了堆栈溢出,对吗?)并且我在 Rails Tut 上使用 Michael Hartl 的 Ruby。第三章有我输入:
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 上使用 rails v 4.2.5 os x el capitan v 10.11.1
非常感谢任何帮助。也许我可以在一两年后还清它!
尝试 运行 没有 sudo
的命令。由于 sudo
以 root 用户身份运行该命令,它会更改您的环境并可能使您使用错误的 Ruby 版本,或者您使用的 Ruby 版本不能查看您已安装的 gem。
编辑: 正如 Eric Platon 指出的那样,尝试在该命令的开头添加 bundle exec
以确保加载捆绑程序并且 [= 的正确版本19=] 将被使用。
Bundler 是一种工具,可确保 运行time 环境使用正确的库和版本。通常,我们会在前面加上命令来进行 Ruby 开发,包括 Rails:
bundle exec rails generate controller StaticPages home help
bundle exec
获取一个命令及其参数,运行 将其放入 Gemfile
中定义的环境中,在同一文件夹中找到。
正如@David Grayson 提到的,sudo
改变了环境。为了代码的安全和打包,最好 运行 作为您的当前用户(并避免部署团队的愤怒)。
所以我是新手(嘿,至少我发现了堆栈溢出,对吗?)并且我在 Rails Tut 上使用 Michael Hartl 的 Ruby。第三章有我输入:
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 上使用 rails v 4.2.5 os x el capitan v 10.11.1
非常感谢任何帮助。也许我可以在一两年后还清它!
尝试 运行 没有 sudo
的命令。由于 sudo
以 root 用户身份运行该命令,它会更改您的环境并可能使您使用错误的 Ruby 版本,或者您使用的 Ruby 版本不能查看您已安装的 gem。
编辑: 正如 Eric Platon 指出的那样,尝试在该命令的开头添加 bundle exec
以确保加载捆绑程序并且 [= 的正确版本19=] 将被使用。
Bundler 是一种工具,可确保 运行time 环境使用正确的库和版本。通常,我们会在前面加上命令来进行 Ruby 开发,包括 Rails:
bundle exec rails generate controller StaticPages home help
bundle exec
获取一个命令及其参数,运行 将其放入 Gemfile
中定义的环境中,在同一文件夹中找到。
正如@David Grayson 提到的,sudo
改变了环境。为了代码的安全和打包,最好 运行 作为您的当前用户(并避免部署团队的愤怒)。