Ruby-on-rails 捆绑安装返回“找不到 Gemfile”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10012181/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bundle install returns "Could not locate Gemfile"
提问by levelone
I'm new to Rails and am currently working through a guide. The guide states:
我是 Rails 的新手,目前正在阅读指南。该指南指出:
Use a text editor to update the Gemfile needed by Bundler with the contents of Listing 2.1.
source 'https://rubygems.org' gem 'rails', '3.2.3' group :development do gem 'sqlite3', '1.3.5' end # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '3.2.4' gem 'coffee-rails', '3.2.2' gem 'uglifier', '1.2.3' end gem 'jquery-rails', '2.0.0' group :production do gem 'pg', '0.12.2' endWe then install and include the gems using the
bundle installcommand:$ bundle install --without productionIf Bundler complains about
no such file to load -- readline (LoadError)try addinggem 'rb-readline'to your Gemfile.)
使用文本编辑器将 Bundler 所需的 Gemfile 更新为清单 2.1 的内容。
source 'https://rubygems.org' gem 'rails', '3.2.3' group :development do gem 'sqlite3', '1.3.5' end # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '3.2.4' gem 'coffee-rails', '3.2.2' gem 'uglifier', '1.2.3' end gem 'jquery-rails', '2.0.0' group :production do gem 'pg', '0.12.2' end然后我们使用以下
bundle install命令安装并包含 gem :$ bundle install --without production如果 Bundler 抱怨
no such file to load -- readline (LoadError)尝试添加gem 'rb-readline'到您的 Gemfile。)
I followed the steps even adding on gem 'rb-readline'to the Gemfile, but apparently the file can't be found and when I go to my text editor I do see the Gemfileitself. I noticed that they made me put gem 'rails', 3.2.3and my version of Rails is 3.2.1 so I tried changing it to 3.2.1 but that didn't work either.
我按照步骤甚至添加gem 'rb-readline'到Gemfile,但显然无法找到该文件,当我转到我的文本编辑器时,我确实看到了Gemfile它本身。我注意到他们让我放入了,gem 'rails', 3.2.3而我的 Rails 版本是 3.2.1,所以我尝试将其更改为 3.2.1,但这也不起作用。
Any thoughts or advice would be much appreciated.
任何想法或建议将不胜感激。
回答by svoisen
You just need to change directories to your app, THEN run bundle install:)
您只需要将目录更改为您的应用程序,然后运行bundle install:)
回答by houbena
You may also indicate the path to the gemfile in the same command e.g.
你也可以在同一个命令中指明 gemfile 的路径,例如
BUNDLE_GEMFILE="MyProject/Gemfile.ios" bundle install
回答by MAILO
I had this problem as well on an OSX machine. I discovered that rails was not installed... which surprised me as I thought OSX always came with Rails. To install rails
我在 OSX 机器上也遇到了这个问题。我发现没有安装 rails ......这让我感到惊讶,因为我认为 OSX 总是带有 Rails。安装导轨
sudo gem install rails- to install jekyll I also needed sudo
sudo gem install jekyll bundlercd ~/Sitesjekyll new <foldername>cd <foldername>ORcd !$(that is magic ;)bundle installbundle exec jekyll serve- Then in your browser just go tohttp://127.0.0.1:4000/and it really should be running
sudo gem install rails- 安装 jekyll 我还需要 sudo
sudo gem install jekyll bundlercd ~/Sitesjekyll new <foldername>cd <foldername>或cd !$(这很神奇;)bundle installbundle exec jekyll serve- 然后在你的浏览器中访问http://127.0.0.1:4000/它真的应该运行
回答by forzagreen
You must be in the same directory of Gemfile
您必须在同一目录中 Gemfile
回答by Dzianis Yafimau
When I had similar problem gem update --systemhelped me. Run this before bundle install
当我遇到类似问题时gem update --system帮助了我。之前运行这个bundle install
回答by osmjit
I had this problem on Ubuntu 18.04. I updated the gem
我在 Ubuntu 18.04 上遇到了这个问题。我更新了宝石
- sudo gem install rails
- sudo gem install jekyll
- sudo gem install jekyll bundler
- cd ~/desiredFolder
- jekyll new
- cd OR
- bundle init
- bundle install
- bundle add jekyll
- bundle exec jekyll serve
- 须藤宝石安装导轨
- 须藤宝石安装 jekyll
- sudo gem 安装 jekyll 捆绑器
- cd ~/所需文件夹
- 杰基尔新
- 光盘或
- 捆绑初始化
- 捆绑安装
- 捆绑添加 jekyll
- 捆绑执行 jekyll 服务
All worked and goto your browser just go to http://127.0.0.1:4000/and it really should be running
一切正常,然后转到您的浏览器,只需转到http://127.0.0.1:4000/,它确实应该运行
回答by adam allalou
1 make sure that the file is Gemfileinstead of gemfile.
1 确保文件Gemfile不是gemfile.
2 make sure you're in the same directory as the Gemfile.
2 确保您与Gemfile.
回答by Anant Agarwal
Search for the Gemfile file in your project, go to that directory and then run "bundle install". prior to running this command make sure you have installed the gem "sudo gem install bundler"
在您的项目中搜索 Gemfile 文件,转到该目录,然后运行“bundle install”。在运行此命令之前,请确保您已安装 gem“sudo gem install bundler”
回答by Cookie
Think more about what you are installing and navigate Gemfile folder, then try using sudo bundle install
多想想你正在安装什么并导航 Gemfile 文件夹,然后尝试使用 sudo bundle install

