0

该应用程序运行良好。它是带有 StimulusJS 的 Rails 5.1。

我试过在服务器上做

RAILS_ENV=production bundle exec rake assets:precompile

没有效果。

似乎无法访问

这是production.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 = false

  # Settings specified here will take precedence over those in config/application.rb.
  # Analytics account
  # Code is not reloaded between requests.
  config.cache_classes = true

  # Eager load code on boot. This eager loads most of Rails and
  # your application in memory, allowing both threaded web servers
  # and those relying on copy on write to perform better.
  # Rake tasks automatically ignore this option for performance.
  config.eager_load = true

  # Full error reports are disabled and caching is turned on.
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  # Compress JavaScripts and CSS.
  config.assets.js_compressor = :uglifier
  # config.assets.css_compressor = :sass

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = true

以及显示错误的控制台屏幕

浏览器控制台日志

4

1 回答 1

0

鉴于“正常”管道中的资产正在工作,并且在尝试了语法的变化后,最终工作的是通过服务器中的 ssh 获取,并运行以下命令:

RAILS_ENV=production bundle exec rails webpacker:compile

似乎普通资产和 webpacker 有两种不同的方式。

于 2019-05-31T08:29:28.800 回答