[英]Rails App Assets Not Being Loaded on Development Environment
Every time I spin up my Rails App locally, none of the CSS shows up. 每次我在本地启动我的Rails应用程序时,都不会显示任何CSS。 The debugger in the browser shows a
get
request for all of the asset files with fingerprinting, but they all fail since the files can't be found. 浏览器中的调试器使用指纹识别显示所有资产文件的
get
请求,但由于无法找到文件,因此它们都会失败。 Here is what one of those requests looks like: 以下是其中一个请求:
GET http://localhost:3000/assets/announcements.self-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css?body=1
In the Rails Server Console, I get a Rack App Error, as well as a NoMethodError
for the undefined method 'Silence'
. 在Rails服务器控制台中,我得到一个Rack App Error,以及
undefined method 'Silence'
的NoMethodError
。 Here is what one of those errors looks like: 以下是其中一个错误:
2017-01-08 17:24:49 -0800: Rack app error handling request { GET /assets/normalize.self-cadbbf81015902777c37852b3ea54398335fd421c6c76891c077ec5954211bb4.css }
NoMethodError: undefined method 'silence' for #<Logger:0x007fe1062c1c78
Both Error logs (Browser Console and Localhost Server Console) contain multiple renditions of the same error, all pointing to Assets (*.js, and *.css). 两个错误日志(浏览器控制台和Localhost服务器控制台)都包含同一错误的多个再现,都指向Assets(* .js和* .css)。
I have searched through countless StackOverflow Posts but to no avail. 我搜索了无数的StackOverflow帖子,但无济于事。 This also for some reason only affects this one application;
这也是出于某种原因只影响这一个应用程序; all my other Rails applications run fine.
我所有其他Rails应用程序运行正常。 Here are my specifications:
这是我的规格:
Rails Version: 5.0.1
Rails版本:
5.0.1
Ruby Version: 2.3.1p112
Ruby版本:
2.3.1p112
Things I have tried: 我尝试过的事情:
assets:clean
, assets:precompile
, rm -rf /tmp
and /public/assets
directpories, all of the previous prepended with the development environment, recloning the repository from github and bundle installing. assets:clean
, assets:precompile
, rm -rf /tmp
和/public/assets
directpories,以前所有的开发环境,从github和bundle安装重新克隆存储库。
I know this is an old question, but stumbled across this while trying to fix the same problem. 我知道这是一个老问题,但在尝试解决同样的问题时偶然发现了这个问题。
I found as well as Ryan Bigg's answer I needed to comment out the following line in development.rb
to stop Sprockets from bombing in Rails 5.2.2: 我发现和Ryan Bigg的答案一样,我需要在
development.rb
注释掉以下行以阻止Sprockets在Rails 5.2.2中进行轰炸:
# Suppress logger output for asset requests.
# config.assets.quiet = true
It looks like you're running into this issue: https://github.com/rails/sprockets-rails/issues/376 . 看起来你遇到了这个问题: https : //github.com/rails/sprockets-rails/issues/376 。
Where you've made this configuration change you should be using ActiveSupport::Logger
instead. 如果您已进行此配置更改,则应使用
ActiveSupport::Logger
。 Where you have Logger.new
, use ActiveSupport::Logger
instead. 如果你有
Logger.new
,请改用ActiveSupport::Logger
。
check The Sprockets 4 Manifest in rails 5 检查导轨5中的链轮4清单
http://eileencodes.com/posts/the-sprockets-4-manifest/ http://eileencodes.com/posts/the-sprockets-4-manifest/
It might help you. 它可能对你有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.