[英]`rails new my_app` returns "Could not locate Gemfile or .bundle/ directory"
我嘗試創建一個新的 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.)
關於什么 :
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.