【问题标题】:No route matches [GET] "/assets/bootstrap.css.map"没有路线匹配 [GET] "/assets/bootstrap.css.map"
【发布时间】:2014-10-18 06:36:23
【问题描述】:

我在 rails4,bootstrap 3 上运行,我在终端中收到以下错误消息。

Started GET "/assets/bootstrap.css.map" for 127.0.0.1 at 2014-08-24 23:41:36 -0700

ActionController::RoutingError (No route matches [GET] "/assets/bootstrap.css.map"):
  actionpack (4.1.4) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'


railties (4.1.4) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.1.4) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.1.4) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.1.4) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.1.4) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.1.4) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  actionpack (4.1.4) lib/action_dispatch/middleware/static.rb:64:in `call'
  rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
  railties (4.1.4) lib/rails/engine.rb:514:in `call'
  railties (4.1.4) lib/rails/application.rb:144:in `call'
  rack (1.5.2) lib/rack/lock.rb:17:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'

有人知道如何摆脱这个吗?

编辑:

这是我的 application.css

*= 要求树。
*= 需要自己
*= require_ladda-themeless
*= 需要 login_form
*= 需要引导
*/

【问题讨论】:

  • 你能发布你的布局文件和你的 application.css(.scss) 吗?你把引导文件放在哪里了?
  • 您如何尝试包含bootstrap.css.map
  • 不...我从未见过它包含在其他人的应用程序中。 @Victor,我的引导文件(bootstrap.js、bootstrap.min.js、bootstrap.css、bootstrap.min.css)分别包含在 app/assets/javascripts、app/assets/stylesheets 中。
  • 我假设您使用的是 gem。它是什么引导宝石?
  • *= require_tree . 在列表的最后使用。

标签: ruby-on-rails twitter-bootstrap


【解决方案1】:

请求bootstrap.css.map的文件是:

/vendor/assets/stylesheets/bootstrap.css

删除最后一行应该可以解决问题:

/*# sourceMappingURL=bootstrap.css.map */

查看here 地图文件的用途。

【讨论】:

【解决方案2】:

我遇到了同样的问题,并在 SO 上找到了这个 short answer。据我了解,地图文件有助于浏览器中的调试工具。快速修复是通过发出命令行查找来查找包含此地图文件的位置。

find . -name "*.css" -o -name "*.scss" | xargs grep 'sourceMappingURL=bootstrap.css.map'

然后从您的 css 文件中删除该行或将其移动到它要查找的位置。

【讨论】:

    【解决方案3】:

    好的,所以我没有在 app/assets 文件夹下拥有本机引导文件,而是在 app/assets/stylesheets 下创建了 custom.css.scss 并包含@import "bootstrap"; 然后,我从解决问题的 app/assets 文件夹中删除了所有引导文件。

    【讨论】:

      【解决方案4】:

      我的错误:ActionController::RoutingError(没有路由匹配 [GET] "/assets/bootstrap.min.css.map"):

      我在 assets 文件夹中创建了一个空的 bootstrap.min.css.map,错误停止了。

      【讨论】:

        猜你喜欢
        • 2011-12-11
        • 1970-01-01
        • 1970-01-01
        • 2017-05-06
        • 2011-10-29
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-01-09
        相关资源
        最近更新 更多