简体   繁体   English

ActionController :: RoutingError(没有路由与[GET]“ / javascripts / application.js”匹配)

[英]ActionController::RoutingError (No route matches [GET] “/javascripts/application.js”)

I'm currently working on a Rails 5.2 application with Vue installed in it via webpacker. 我目前正在使用通过Webpacker安装了Vue的Rails 5.2应用程序。 However, I have not done any styling. 但是,我没有做任何样式。 I'm just setting the authentication. 我只是设置身份验证。 When I go to users/sign_out I get the following error. 当我转到users/sign_out ,出现以下错误。

ActionController::RoutingError (No route matches [GET] "/javascripts/application.js"): ActionController :: RoutingError(没有路由与[GET]“ / javascripts / application.js”匹配):

I do have a file in /javascripts/application.js which had the following code: 我在/javascripts/application.js确实有一个文件,该文件具有以下代码:

// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's
// vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file. JavaScript code in this file should be added after the last require_* statement.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require rails-ujs
//= require activestorage
//= require_tree .

Not sure what the issue is here. 不知道这里是什么问题。

<head>
    <title>ArtsySpace</title>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= stylesheet_link_tag    'application', media: 'all' %>
    <%= javascript_include_tag 'application' %>
  </head>

in environments/development.rb/ environments/development.rb/

Rails.application.configure do
  # Verifies that versions and hashed value of the package contents in the project's package.json
  config.webpacker.check_yarn_integrity = true
  # Settings specified here will take precedence over those in config/application.rb.

  config.cache_classes = false

  # Do not eager load code on boot.
  config.eager_load = false

  # Show full error reports.
  config.consider_all_requests_local = true

  config.assets.debug = false
  # Enable/disable caching. By default caching is disabled.
  # Run rails dev:cache to toggle caching.
  if Rails.root.join('tmp', 'caching-dev.txt').exist?
    config.action_controller.perform_caching = true

    config.cache_store = :memory_store
    config.public_file_server.headers = {
      'Cache-Control' => "public, max-age=#{2.days.to_i}"
    }
  else
    config.action_controller.perform_caching = false

    config.cache_store = :null_store
  end

  # Store uploaded files on the local file system (see config/storage.yml for options)
  config.active_storage.service = :local

  # Print deprecation notices to the Rails logger.
  config.active_support.deprecation = :log

  # Raise an error on page load if there are pending migrations.
  config.active_record.migration_error = :page_load

  # Highlight code that triggered database queries in logs.
  config.active_record.verbose_query_logs = true

  config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

  config.webpacker.check_yarn_integrity = false


  # Raises error for missing translations
  # config.action_view.raise_on_missing_translations = true

  # Use an evented file watcher to asynchronously detect changes in source code,
  # routes, locales, etc. This feature depends on the listen gem.
  config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end

这是旧的,但对于遇到此问题的任何人,您都需要将以下内容更改: <%= javascript_include_tag 'application' %>更改为<%= javascript_pack_tag 'application' %>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我得到这个 ActionController::RoutingError (没有路由匹配 [GET] “/users/assets/application.js”) - Why I am getting this ActionController::RoutingError (No route matches [GET] “/users/assets/application.js”) ActionController :: RoutingError(没有路由与[GET]匹配” / assets / javascripts - ActionController::RoutingError (No route matches [GET] "/assets/javascripts Ruby on Rails:PDF.JS ActionController :: RoutingError(没有路由与[GET]“ / pdf js / web / viewer.html”匹配): - Ruby on Rails: PDF.JS ActionController::RoutingError (No route matches [GET] “/pdf js/web/viewer.html”): ActionController :: RoutingError(没有路由匹配[GET]“/members/js/bootstrap.min.js&quot;):(Missing资产文件) - ActionController::RoutingError (No route matches [GET] “/members/js/bootstrap.min.js”):(Missing Asset files) ActionController :: RoutingError(没有路由与[GET] controller_name / fusioncharts.widgets.js匹配 - ActionController::RoutingError (No route matches [GET] controller_name/fusioncharts.widgets.js 如何从另一个Rails项目中调用JavaScript文件? ActionController :: RoutingError(没有路由与[GET]“ / assets / trackmetrics.js”匹配) - How do call a javascript file from another Rails project? ActionController::RoutingError (No route matches [GET] “/assets/trackmetrics.js”) 服务器上的Rails 6收到很多“ ActionController :: RoutingError:没有路由匹配[GET] /31194a065aebf1674b61.worker.js”的请求 - Rails 6 on server getting a lot of “ActionController::RoutingError: No route matches [GET] /31194a065aebf1674b61.worker.js” requests ActionController::RoutingError (没有路由匹配 [GET] “/vendor/assets/stylesheets/bootstrap.min.css”) - ActionController::RoutingError (No route matches [GET] “/vendor/assets/stylesheets/bootstrap.min.css”) Rails CORS:ActionController::RoutingError(没有路由匹配 [OPTIONS] &quot;/batches&quot;): - Rails CORS: ActionController::RoutingError (No route matches [OPTIONS] "/batches"): RoutingError没有与[GET]“ /missing.png”匹配的路由 - RoutingError No route matches [GET] “/missing.png”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM