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

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

新規登録して質問してみよう
ただいま回答率
85.50%
Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

4052閲覧

【railsの開発環境】ruby bin/rails sでエラーがでます!

s.k

総合スコア423

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

1クリップ

投稿2016/05/26 03:20

編集2016/05/26 03:23

こんにちは!
s.kです!

何度も似たような質問してますが今回で蹴りつけますぜ!
みなさん、何卒よろしくお願いします。

私の今のゴールはアプリケーションを起動し、railsアプリケーションの初期画面を表示させる(http://localhost:3000/に飛ぶ)ことです。
しかし、大きな問題が二つあります。

この問題を解決したいのでこれから状況を説明します。
説明の流れは、問題⇒環境⇒手順と実行に対して出力された内容とします。

■問題

http://localhost:3000/とブラウザに入力するが、初期画面が表示されない。(スクショ添付)
②初期画面前の最後実行でエラー(おそらくこれが問題なのですが原因がわかりません)

▼コマンドプロンプトへの入力内容

C:\rails\asagao>ruby bin/rails s

▼返ってきた内容

C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:89:in rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError) Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes. Backtrace for gem load error is: C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs/runtimes.rb:58:in autodetect'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:5:in <module:ExecJS>' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/execjs-2.7.0/lib/execjs.rb:4:in <top (required)>'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in require' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in <top (required)>'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:86:in require' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:86:in block (2 levels) in require'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:81:in each' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:81:in block in require'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:70:in each' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:70:in require'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler.rb:102:in require' C:/rails/asagao/config/application.rb:7:in <top (required)>'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in require' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in block in server'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in tap' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in server'
C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in run_command!' C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in <top (required)>'
bin/rails:4:in require' bin/rails:4:in <main>'
Bundler Error Backtrace:
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:85:in block (2 levels) in require' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:81:in each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:81:in block in require' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:70:in each'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler/runtime.rb:70:in require' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/bundler-1.12.4/lib/bundler.rb:102:in require'
from C:/rails/asagao/config/application.rb:7:in <top (required)>' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in require'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in block in server' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in tap'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in server' from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in run_command!'
from C:/Ruby21-x64/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in <top (required)>' from bin/rails:4:in require'
from bin/rails:4:in `<main>'

■環境

・Windows10(64bit)
・ruby 2.1.6p336 (2015-04-13 revision 50298) [x64-mingw32]
・Rails 4.2.6

■手順

①rubyを専用サイトよりインストール。
この時環境変数のpath設定にのみチェック。
保存場所はデフォルトのC:\Ruby21

②専用サイトよりDevKitのインストール
保存場所はいろいろ(うまくいかなかったのでいろんなパターンを…)
∟\DevKit・\devkit\・\Downloadsなど

③RailsインストールのためDevKitのコンパイラを使えるようにした。

C:\Users\keiga>C:\devkit\devkitvars←実行内容(入力文字)
Adding the DevKit to PATH...←返答
指定されたファイルが見つかりません。

ここは正常に作動しているとお話を受けました!tkmtmktさんに解決していただきました!

④cacert.pemのダウンロード

C:\Users\keiga>set SSL_CERT_FILE=C:Users\keiga\cacert.pem(入力)
セキュリティの警告からのアクセス許可。

⑤gemコマンドでrailsのインストール

C:\Users\keiga>gem install rails --version "4.2.6" --no-rdoc --no-ri

Successfully installed rails-4.2.6
1 gem installed

⑥アプリケーションの作成

C:\Users\keiga>cd \

C:>mkdir rails
サブディレクトリまたはファイル rails は既に存在します。

C:>cd rails

C:\rails>cd asagao

⑦bundle installの実行

C:\rails\asagao>bundle install

Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using debug_inspector 0.0.2
Using byebug 9.0.4
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using multi_json 1.12.1
Using bundler 1.12.4
Using sass 3.4.22
Using tilt 2.0.4
Using sqlite3 1.3.11
Using rdoc 4.2.2
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mime-types 3.1
Using binding_of_caller 0.7.2
Using coffee-script 2.4.1
Using uglifier 3.0.0
Using sprockets 3.6.0
Using sdoc 0.4.1
Using activesupport 4.2.6
Using tzinfo-data 1.2016.4
Using loofah 2.0.3
Using mail 2.6.4
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.6
Using jbuilder 2.4.1
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using activejob 4.2.6
Using activerecord 4.2.6
Using actionview 4.2.6
Using actionpack 4.2.6
Using actionmailer 4.2.6
Using railties 4.2.6
Using sprockets-rails 3.0.4
Using coffee-rails 4.1.1
Using jquery-rails 4.1.1
Using rails 4.2.6
Using sass-rails 5.0.4
Using web-console 2.3.0
Using turbolinks 2.5.3
Bundle complete! 12 Gemfile dependencies, 55 gems now installed.
Use bundle show [gemname] to see where a bundled gem is installed.

そして、問題である、
ruby bin/rails s
を入力するとエラーが発生するのです。

ずっと悩んでて前に進めません。
何卒宜しくお願いします!!!!

http://localhost:3000/

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

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

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

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

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

guest

回答1

0

ベストアンサー

冒頭部に

Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.

とあるように、JavaScriptの実行ランタイムが見つからないためのエラーです。

WindowsだとWSHがあるはずなのですが、どうも見つけられていないようです。ただ、WSHはJavaScript「への対応が古くて問題を起こすことが多いので、Node.jsをインストールすることをおすすめします。

投稿2016/05/26 03:27

maisumakun

総合スコア145123

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

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

s.k

2016/05/26 03:35

maisumakunさん ありがとうございます! 早速Node.jsをインストールしますね!
s.k

2016/05/26 03:58

maisumakunさん できました! ありがとうございます! 今後共、よろしくお願い致します!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問