###前提・実現したいこと
書いたcssの内容を反映させたい
###発生している問題・エラーメッセージ
最近ruby,ruby on rails の勉強をし始めた初心者です。
テストとしてwebページを起こそうとしていましたら、
Showing C:/myblog/app/views/layouts/application.html.erb where line #7 raised:
No such file or directory @ unlink_internal - C:/Users/〇〇 ~1/AppData/Local/Temp/execjs20171221-6084-1ou0o4kjson
Extracted source (around line #7):
5 <%= csrf_meta_tags %>
6
7 <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8 <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9 </head>
10
と出まして、どうにかしようと
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
を削除してみたところ、ちゃんとwebにはサイトが現れました。
次にindex.html.erbファイルでHTMLを書き
applicaton.cssでcssを書きwebサイトを更新しましたがうまく反映されませんでした。
そこでさきほど削除したコードを元に戻すとやはりまた同じようなエラーが出ます。また調べ直してコードを
<%= stylesheet_link_tag '/app/assets/application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag '/app/assets/application', 'data-turbolinks-track': 'reload' %>
のように直したのですがそれでも反映されません。
根本的なところから間違っているのでしょうか。調べ方もわからず困っています。
私はオンラインのプログラム教材を通して勉強しているのですが同じように進めてみても行き詰ってしまいます。
初歩的な内容で恐縮なのですが、回答していただけるととても助かります。
###追記
app/assets/stylesheetsの中身はapplication.cssとposts.scssファイルがありまして
下のコードがapplication.cssのファイルです。posts.scssはいじってないです。
javascriptsのほうはapplication.js,cable.js,posts.coffeeとchannelsフォルダがあります。
channelsフォルダには.keepがあります。javascriptsのほうも触ってません。
- This is a manifest file that'll be compiled into application.css, which will include all the files
- listed below.
- Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
- vendor/assets/stylesheets directory can be referenced here using a relative path.
- You're free to add application-wide styles to this file and they'll appear at the bottom of the
- compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
- files in this directory. Styles in this file should be added after the last require_* statement.
- It is generally better to create a new file per style scope.
*= require_tree .
*= require_self
*/
.container {
width: 400px;
margin: 20px auto;
}
body {
font-size: : 14px;
font-family: Verdana, sans-serif;
}
h2 {
font-size: 10000px;
padding-bottom: 10px;
margin-bottom: 15px;
border-bottom: 15px;
border-bottom: 1px solid #ddd;
}
ul > li {
margin-bottom: 5px;
}
何度もありがとうございます。ログですが該当箇所がどこなのかわからないです。
おそらくこの辺かなと思うところを貼ります。勉強不足ですいません。
Started GET "/app/assets/application.css" for 127.0.0.1 at 2017-12-21 22:36:51 +0900
ActionController::RoutingError (No route matches [GET] "/app/assets/application.css"):
Started GET "/app/assets/application.js" for 127.0.0.1 at 2017-12-21 22:36:51 +0900
actionpack (5.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:63:in call' web-console (3.5.1) lib/web_console/middleware.rb:135:in
call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in block in call' web-console (3.5.1) lib/web_console/middleware.rb:18:in
catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in call' actionpack (5.1.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in
call'
railties (5.1.4) lib/rails/rack/logger.rb:36:in call_app' railties (5.1.4) lib/rails/rack/logger.rb:24:in
block in call'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in block in tagged' activesupport (5.1.4) lib/active_support/tagged_logging.rb:26:in
tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in tagged' railties (5.1.4) lib/rails/rack/logger.rb:24:in
call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in call' actionpack (5.1.4) lib/action_dispatch/middleware/remote_ip.rb:79:in
call'
actionpack (5.1.4) lib/action_dispatch/middleware/request_id.rb:25:in call' rack (2.0.3) lib/rack/method_override.rb:22:in
call'
rack (2.0.3) lib/rack/runtime.rb:22:in call' activesupport (5.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in
call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in call' actionpack (5.1.4) lib/action_dispatch/middleware/static.rb:125:in
call'
rack (2.0.3) lib/rack/sendfile.rb:111:in call' railties (5.1.4) lib/rails/engine.rb:522:in
call'
puma (3.11.0) lib/puma/configuration.rb:225:in call' puma (3.11.0) lib/puma/server.rb:624:in
handle_request'
puma (3.11.0) lib/puma/server.rb:438:in process_client' puma (3.11.0) lib/puma/server.rb:302:in
block in run'
puma (3.11.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
ActionController::RoutingError (No route matches [GET] "/app/assets/application.js"):
actionpack (5.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:63:in call' web-console (3.5.1) lib/web_console/middleware.rb:135:in
call_app'
web-console (3.5.1) lib/web_console/middleware.rb:28:in block in call' web-console (3.5.1) lib/web_console/middleware.rb:18:in
catch'
web-console (3.5.1) lib/web_console/middleware.rb:18:in call' actionpack (5.1.4) lib/action_dispatch/middleware/show_exceptions.rb:31:in
call'
railties (5.1.4) lib/rails/rack/logger.rb:36:in call_app' railties (5.1.4) lib/rails/rack/logger.rb:24:in
block in call'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in block in tagged' activesupport (5.1.4) lib/active_support/tagged_logging.rb:26:in
tagged'
activesupport (5.1.4) lib/active_support/tagged_logging.rb:69:in tagged' railties (5.1.4) lib/rails/rack/logger.rb:24:in
call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in call' actionpack (5.1.4) lib/action_dispatch/middleware/remote_ip.rb:79:in
call'
actionpack (5.1.4) lib/action_dispatch/middleware/request_id.rb:25:in call' rack (2.0.3) lib/rack/method_override.rb:22:in
call'
rack (2.0.3) lib/rack/runtime.rb:22:in call' activesupport (5.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:27:in
call'
actionpack (5.1.4) lib/action_dispatch/middleware/executor.rb:12:in call' actionpack (5.1.4) lib/action_dispatch/middleware/static.rb:125:in
call'
rack (2.0.3) lib/rack/sendfile.rb:111:in call' railties (5.1.4) lib/rails/engine.rb:522:in
call'
puma (3.11.0) lib/puma/configuration.rb:225:in call' puma (3.11.0) lib/puma/server.rb:624:in
handle_request'
puma (3.11.0) lib/puma/server.rb:438:in process_client' puma (3.11.0) lib/puma/server.rb:302:in
block in run'
puma (3.11.0) lib/puma/thread_pool.rb:120:in `block in spawn_thread'