前提・実現したいこと
Ruby on Railsの環境構築を参考書通りに進めているのですが、localhostのサーバーにアクセスができません。
コマンドプロンプトでrubyとrailsをインストールした後、rails new RailsAppというコマンドを打ち、そこからrails serverで接続しようとしたところ失敗しました。
localhostのサーバーに接続したいです。
発生している問題・エラーメッセージ
エラーメッセージ
該当のソースコード
1回目
C:\Users\kanon\デスクトップ>rails new RailsApp C:\Users\kanon\デスクトップ>cd RailsApp C:\Users\kanon\デスクトップ\RailsApp>rails server Usage: rails new APP_PATH [options] Options: [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications) -r, [--ruby=PATH] # Path to the Ruby binary of your choice # Default: C:/Ruby26-x64/bin/ruby.exe -m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL) -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/postgresql/sqlite3/oracle/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc) # Default: sqlite3 [--skip-gemfile], [--no-skip-gemfile] # Don't create a Gemfile -G, [--skip-git], [--no-skip-git] # Skip .gitignore file [--skip-keeps], [--no-skip-keeps] # Skip source control .keep files -M, [--skip-action-mailer], [--no-skip-action-mailer] # Skip Action Mailer files [--skip-action-mailbox], [--no-skip-action-mailbox] # Skip Action Mailbox gem [--skip-action-text], [--no-skip-action-text] # Skip Action Text gem -O, [--skip-active-record], [--no-skip-active-record] # Skip Active Record files [--skip-active-storage], [--no-skip-active-storage] # Skip Active Storage files -P, [--skip-puma], [--no-skip-puma] # Skip Puma related files -C, [--skip-action-cable], [--no-skip-action-cable] # Skip Action Cable files -S, [--skip-sprockets], [--no-skip-sprockets] # Skip Sprockets files [--skip-spring], [--no-skip-spring] # Don't install Spring application preloader [--skip-listen], [--no-skip-listen] # Don't generate configuration that depends on the listen gem -J, [--skip-javascript], [--no-skip-javascript] # Skip JavaScript files [--skip-turbolinks], [--no-skip-turbolinks] # Skip turbolinks gem -T, [--skip-test], [--no-skip-test] # Skip test files [--skip-system-test], [--no-skip-system-test] # Skip system test files [--skip-bootsnap], [--no-skip-bootsnap] # Skip bootsnap gem [--dev], [--no-dev] # Setup the application with Gemfile pointing to your Rails checkout [--edge], [--no-edge] # Setup the application with Gemfile pointing to Rails repository [--rc=RC] # Path to file containing extra configuration options for rails command [--no-rc], [--no-no-rc] # Skip loading of extra configuration options from .railsrc file [--api], [--no-api] # Preconfigure smaller stack for API only apps -B, [--skip-bundle], [--no-skip-bundle] # Don't run bundle install --webpacker, [--webpack=WEBPACK] # Preconfigure Webpack with a particular framework (options: react, vue, angular, elm, stimulus) [--skip-webpack-install], [--no-skip-webpack-install] # Don't run Webpack install Runtime options: -f, [--force] # Overwrite files that already exist -p, [--pretend], [--no-pretend] # Run but do not make any changes -q, [--quiet], [--no-quiet] # Suppress status output -s, [--skip], [--no-skip] # Skip files that already exist Rails options: -h, [--help], [--no-help] # Show this help message and quit -v, [--version], [--no-version] # Show Rails version number and quit Description: The 'rails new' command creates a new Rails application with a default directory structure and configuration at the path you specify. You can specify extra command-line arguments to be used every time 'rails new' runs in the .railsrc configuration file in your home directory. Note that the arguments specified in the .railsrc file don't affect the defaults values shown above in this help message. Example: rails new ~/Code/Ruby/weblog This generates a skeletal Rails installation in ~/Code/Ruby/weblog. C:\Users\kanon\デスクトップ\RailsApp>ruby bin/rails server Traceback (most recent call last): ruby: No such file or directory -- bin/rails (LoadError)
2回目 rails new sample-app Gで作成したもの(文字数の関係で途中省略しています)
C:\Users\kanon\デスクトップ\sample_app>rails s => Booting Puma => Rails 6.0.2.1 application starting in development => Run `rails server --help` for more startup options Exiting C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/webpacker-4.2.2/lib/webpacker/configuration.rb:92:in `read': No such file or directory @ rb_sysopen - C:/Users/kanon/デスクトップ/sample_app/config/webpacker.yml (Errno::ENOENT) 48: from bin/rails:4:in `<main>' 47: from bin/rails:4:in `require' 46: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/commands.rb:18:in `<top (required)>' 45: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/command.rb:46:in `invoke' 44: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties-6.0.2.1/lib/rails/command/base.rb:69:in `perform' 43: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch' 42: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' 41: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' 40: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/railties- C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/webpacker-4.2.2/lib/webpacker/configuration.rb:95:in `rescue in load': Webpacker configuration file not found C:/Users/kanon/デスクトップ/sample_app/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - C:/Users/kanon/デスクトップ/sample_app/config/webpacker.yml (RuntimeError)
試したこと
rails new RailsAppを再度試した。
2回目として、
Rails6 Webpackerでエラーが出たとRails6開発時につまづきそうなwebpacker、yarn関係のエラーと解決方法を参考に、webpacker、yarnをローカルにインストールしたがサーバーに接続できなかった。
補足情報(FW/ツールのバージョンなど)
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
Rails 6.0.2.1
参考書によるとrails new 〇〇は時間がかかるそうなのですが、当方の場合すぐに終わってしまったためそこに原因があるのかと思いました。
初心者なので至らない点があると思いますがよろしくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/03/14 08:34
2020/03/14 08:41
2020/03/14 08:48
2020/03/14 09:00