Ruby on rails `rails新my_应用程序“返回”;找不到文件或.bundle/directory";

Ruby on rails `rails新my_应用程序“返回”;找不到文件或.bundle/directory";,ruby-on-rails,bundle,gemfile,Ruby On Rails,Bundle,Gemfile,我尝试创建一个新的Rails应用程序,但出现以下错误: % bundle exec rails new my_app Could not locate Gemfile or .bundle/ directory 我尝试运行bundle,但得到了相同的错误 我做错了什么?只需停止命令的bundle exec部分: % bundle exec rails new my_app Could not locate Gemfile or .bundle/ directory % rails new

我尝试创建一个新的Rails应用程序,但出现以下错误:

% bundle exec rails new my_app
Could not locate Gemfile or .bundle/ directory
我尝试运行
bundle
,但得到了相同的错误


我做错了什么?

只需停止命令的
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.)
那么:

  • rails新应用程序名称
  • cd应用程序名称

问题包括,
rails new
命令上的
bundle exec
。这就是我建议删除bundle exec的原因