【发布时间】:2020-03-05 13:34:34
【问题描述】:
我尝试创建一个新的 Rails 应用程序,但收到此错误:
% bundle exec rails new my_app
Could not locate Gemfile or .bundle/ directory
我尝试运行bundle 并得到同样的错误。
我做错了什么?
【问题讨论】:
标签: ruby-on-rails bundle gemfile
我尝试创建一个新的 Rails 应用程序,但收到此错误:
% bundle exec rails new my_app
Could not locate Gemfile or .bundle/ directory
我尝试运行bundle 并得到同样的错误。
我做错了什么?
【问题讨论】:
标签: ruby-on-rails bundle gemfile
只需去掉命令的bundle exec 部分:
% bundle exec rails new my_app
Could not locate Gemfile or .bundle/ directory
% rails new my_app
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
(etc.)
在生成新的 Rails 应用程序的情况下(作为一名全职 Rails 开发人员,我在几年内只做过 3-4 次),还没有 Gemfile……就像错误提示的那样。 rails new my_app 可能是 Rails 环境中唯一不能在 bundler 下运行的命令。
如果您的 shell 中有 alias rails=bundle exec rails,或者您的手指刚刚被训练为始终为 rails 命令键入 bundle exec,这可能是一个特殊的问题。在这种情况下,您可以删除该别名 (unalias rails),但最好通过将其括在引号中来绕过该别名:
"rails" new my_app
create
create README.md
create Rakefile
(etc.)
【讨论】:
怎么样:
【讨论】:
bundle exec 在rails new 命令上。