Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试在我的 Mac 上设置 RVM。当我bundle install在一个空文件夹(一个虚拟项目文件夹)中运行时,我收到以下错误:
bundle install
Could not locate Gemfile or .bundle/ directory
问题:
我需要将任何 gem 文件复制到虚拟项目文件夹吗?如果是这样,什么宝石,从哪里来?
我需要安装其他东西吗?
您只需要检查您当前是否在 rails app 文件夹中(在大多数情况下)或仔细检查您是否已正确创建 rails 应用程序。
在这里,我正在尝试执行启动 rails 服务器的命令,
bundle exec rails server
如您所见,由于我不在该文件夹中,因此无法找到启动服务所需的 gem。
并弹出如下错误
找不到 Gemfile 或 .bundle/ 目录
仅删除cd到应用程序文件夹中
cd
cd YourAPPfolder
并再次运行所需的 rails 命令。
你完成了。瞧!
在运行 bundle install 之前,请确保您位于项目目录中。例如,在运行之后rails new myapp,你会想要cd myapp在运行之前bundle install
rails new myapp
cd myapp