質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.38%
Windows 11

Windows 11は、Windows 10の後継バージョン。それまでのMetroデザインを廃止し、Fluentデザインを導入しています。スタートメニューの構成やウィンドウのデザインの変更の他、Androidアプリをネイティブに実行できます。

Ruby on Rails 7

Ruby on Rails 7は、2021年12月に正式リリースされました。Ruby on Railsのバージョン7であり、フロントエンド開発環境を大幅に刷新。Node.jsを用いない構成がデフォルトになっています。

Q&A

解決済

1回答

211閲覧

rails consoleを実行しても、使い方一覧が表示されるだけ

arayada

総合スコア11

Windows 11

Windows 11は、Windows 10の後継バージョン。それまでのMetroデザインを廃止し、Fluentデザインを導入しています。スタートメニューの構成やウィンドウのデザインの変更の他、Androidアプリをネイティブに実行できます。

Ruby on Rails 7

Ruby on Rails 7は、2021年12月に正式リリースされました。Ruby on Railsのバージョン7であり、フロントエンド開発環境を大幅に刷新。Node.jsを用いない構成がデフォルトになっています。

0グッド

0クリップ

投稿2024/09/07 14:15

実現したいこと

rails consoleを使いたい

発生している問題・分からないこと

起動せず、使用方法?がずらっと一覧で出るだけ。

エラーメッセージ

error

1Usage: 2 rails new APP_PATH [options] 3 4Options: 5 [--skip-namespace] 6 # Skip namespace (affects only isolated engines) 7 8 # Default: false 9 [--skip-collision-check] 10 # Skip collision check 11 12 # Default: false 13 -r, [--ruby=PATH] 14 # Path to the Ruby binary of your choice 15 16 # Default: C:/Ruby33-x64/bin/ruby.exe 17 -n, [--name=NAME] 18 # Name of the app 19 -m, [--template=TEMPLATE] 20 # Path to some application template (can be a filesystem path or URL) 21 -d, [--database=DATABASE] 22 # Preconfigure for selected database 23 24 # Default: sqlite3 25 26 # Possible values: mysql, trilogy, postgresql, sqlite3 27 -G, [--skip-git] 28 # Skip git init, .gitignore and .gitattributes 29 [--skip-docker] 30 # Skip Dockerfile, .dockerignore and bin/docker-entrypoint 31 [--skip-keeps] 32 # Skip source control .keep files 33 -M, [--skip-action-mailer] 34 # Skip Action Mailer files 35 [--skip-action-mailbox] 36 # Skip Action Mailbox gem 37 [--skip-action-text] 38 # Skip Action Text gem 39 -O, [--skip-active-record] 40 # Skip Active Record files 41 [--skip-active-job] 42 # Skip Active Job 43 [--skip-active-storage] 44 # Skip Active Storage files 45 -C, [--skip-action-cable] 46 # Skip Action Cable files 47 -A, [--skip-asset-pipeline] 48 # Indicates when to generate skip asset pipeline 49 -a, [--asset-pipeline=ASSET_PIPELINE] 50 # Choose your asset pipeline 51 52 # Default: sprockets 53 54 # Possible values: none, sprockets, propshaft 55 -J, --skip-js, [--skip-javascript] 56 # Skip JavaScript files 57 [--skip-hotwire] 58 # Skip Hotwire integration 59 [--skip-jbuilder] 60 # Skip jbuilder gem 61 -T, [--skip-test] 62 # Skip test files 63 [--skip-system-test] 64 # Skip system test files 65 [--skip-bootsnap] 66 # Skip bootsnap gem 67 [--skip-dev-gems] 68 # Skip development gems (e.g., web-console) 69 [--skip-rubocop] 70 # Skip RuboCop setup 71 [--skip-brakeman] 72 # Skip brakeman setup 73 [--skip-ci] 74 # Skip GitHub CI files 75 [--dev], [--no-dev], [--skip-dev] 76 # Set up the application with Gemfile pointing to your Rails checkout 77 [--devcontainer], [--no-devcontainer], [--skip-devcontainer] # Generate devcontainer files 78 79 # Default: false 80 [--edge], [--no-edge], [--skip-edge] 81 # Set up the application with a Gemfile pointing to the 7-2-stable branch on the Rails repository 82 --master, [--main], [--no-main], [--skip-main] 83 # Set up the application with Gemfile pointing to Rails repository main branch 84 [--rc=RC] 85 # Path to file containing extra configuration options for rails command 86 [--no-rc] 87 # Skip loading of extra configuration options from .railsrc file 88 [--api], [--no-api], [--skip-api] 89 # Preconfigure smaller stack for API only apps 90 91 # Default: false 92 [--minimal], [--no-minimal], [--skip-minimal] # Preconfigure a minimal rails app 93 -j, --js, [--javascript=JAVASCRIPT] 94 # Choose JavaScript approach 95 96 # Default: importmap 97 98 # Possible values: importmap, bun, webpack, esbuild, rollup 99 -c, [--css=CSS] 100 # Choose CSS processor. Check https://github.com/rails/cssbundling-rails for more options 101 102 # Possible values: tailwind, bootstrap, bulma, postcss, sass 103 -B, [--skip-bundle] 104 # Don't run bundle install 105 [--skip-decrypted-diffs] 106 # Don't configure git to show decrypted diffs of encrypted credentials 107 108Runtime options: 109 -f, [--force] # Overwrite files that already exist 110 -p, [--pretend], [--no-pretend], [--skip-pretend] # Run but do not make any changes 111 -q, [--quiet], [--no-quiet], [--skip-quiet] # Suppress status output 112 -s, [--skip], [--no-skip], [--skip-skip] # Skip files that already exist 113 114Rails options: 115 -h, [--help], [--no-help], [--skip-help] # Show this help message and quit 116 -v, [--version], [--no-version], [--skip-version] # Show Rails version number and quit 117 118Description: 119 The `rails new` command creates a new Rails application with a default 120 directory structure and configuration at the path you specify. 121 122 You can specify extra command-line arguments to be used every time 123 `rails new` runs in the .railsrc configuration file in your home directory, 124 or in $XDG_CONFIG_HOME/rails/railsrc if XDG_CONFIG_HOME is set. 125 126 Note that the arguments specified in the .railsrc file don't affect the 127 default values shown above in this help message. 128 129 You can specify which version to use when creating a new rails application 130 using `rails _<version>_ new`. 131 132Examples: 133 `rails new ~/Code/Ruby/weblog` 134 135 This generates a new Rails app in ~/Code/Ruby/weblog. 136 137 `rails _<version>_ new weblog` 138 139 This generates a new Rails app with the provided version in ./weblog. 140 141 `rails new weblog --api` 142 143 This generates a new Rails app in API mode in ./weblog. 144 145 `rails new weblog --skip-action-mailer` 146 147 This generates a new Rails app without Action Mailer in ./weblog. 148 Any part of Rails can be skipped during app generation.

該当のソースコード

特になし

試したこと・調べたこと

  • teratailやGoogle等で検索した
  • ソースコードを自分なりに変更した
  • 知人に聞いた
  • その他
上記の詳細・結果

springというプロセスが動いているとconsoleが起動しないことがある、とのことで bundle exec spring stopでkillしてみたが、Could not locate Gemfile or .bundle/ directoryという結果。

補足

特になし

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

rails console は rails のアプリを作ってその RAILS_ROOT に cdして初めて使えます。
表示されるusageに rails new APP_PATH [options] とあるのは rails console の console が 素の rails のサブコマンドに無いから、素 のrails の使い方が表示された、ということです。
rails new でできたアプリのdirectoryにcdすると そこに bin directoryができそこに rails というコマンドができています。rails console はそのrailsのサブコマンドです。
おまじないをしないと bundle exec rails console としないと起動しないかも。

投稿2024/09/07 23:11

winterboum

総合スコア23522

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

arayada

2024/09/09 13:00

回答ありがとうございます。 サブコマンドというんですね。該当のディレクトリでgitをインストールしていないがために、binファイルが生成されていませんでした。そのためrails consoleが使えなかったんですね。 助かりました!
winterboum

2024/09/09 13:35

いや git は関係ないです。 rails new app-dir して cd app-dir したかどうか です
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.38%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問