在Rails / Solidus App的Git克隆之后,资产管道无法正确加载

如何解决在Rails / Solidus App的Git克隆之后,资产管道无法正确加载

我做了一个rails / solidus应用程序的git clone,它在我的本地计算机上运行良好,但是在Production中进行部署后,CSS和JS无法正常工作。我使用Rails 6,webpack和链轮。

资产管道的请求已完成,但是当我在DOM中查看响应时,响应为“找不到404” GEThttps://marguery.cleverapps.io/assets/application-b31b32abb971f17a524d21ec2a0da1c8e278eeec1494078c645d0b78c1421333.css[HTTP/1.1 404 Not Found 131ms]

GEThttps://marguery.cleverapps.io/packs/js/application-8a33c36bccf807dbd76b.js[HTTP/1.1 404 Not Found 320ms]

当我尝试连接商店时,出现错误

"Can't verify CSRF token authenticity"

您可以通过此链接查看 https://marguery.cleverapps.io/

似乎指纹是错误的?我认为某个地方有以前应用程序的一些旧数据,但是我找不到在哪里以及如何重新初始化它

对于我的第一次部署,

ArgumentError:“生产”环境缺少secret_key_base,请使用rails credentials:edit设置此字符串

所以我已经删除了现有的certificate.yml.enc并运行:rails credentials:edit创建一个新的凭据。

该部署已获授权。

我尝试过:

我在我的语言环境计算机上进行了操作。 RAILS_ENV=production rails assets:precompile

ActiveSupport::MessageEncryptor::InvalidMessage: ActiveSupport::MessageEncryptor::InvalidMessage
/mnt/882A716B2A7156E2/0-Projets/maisonmarguery2/maisonmarguery/config/environment.rb:5:in `<main>'
/mnt/882A716B2A7156E2/0-Projets/maisonmarguery2/maisonmarguery/bin/rails:9:in `<top (required)>'
/mnt/882A716B2A7156E2/0-Projets/maisonmarguery2/maisonmarguery/bin/spring:15:in `<top (required)>'
./bin/rails:3:in `load'
./bin/rails:3:in `<main>' 

我在服务器端做了 rails assets:precompile

yarn install v1.22.4
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.00s.
Everything's up-to-date. Nothing to do

我的配置/环境/production.rb

Rails.application.configure do
  
  config.cache_classes = true

  
  config.eager_load = true

  
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true

  
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?

  # Compress CSS using a preprocessor.
  config.assets.css_compressor = :sass

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

 

  # Specifies the header that your server uses for sending files.
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

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

  
  config.log_level = :debug

  
  config.log_tags = [ :request_id ]

  

  config.action_mailer.perform_caching = false

  
  config.active_support.deprecation = :notify

  # Use default logging formatter so that PID and timestamp are not suppressed.
  config.log_formatter = ::Logger::Formatter.new


  if ENV["RAILS_LOG_TO_STDOUT"].present?
    logger           = ActiveSupport::Logger.new(STDOUT)
    logger.formatter = config.log_formatter
    config.logger    = ActiveSupport::TaggedLogging.new(logger)
  end

  # Do not dump schema after migrations.
  config.active_record.dump_schema_after_migration = false

 
end

我的宝石文件

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.6.5'

# Bundle edge Rails instead: gem 'rails',github: 'rails/rails'
gem 'rails','~> 6.0.3','>= 6.0.3.2'
# Use sqlite3 as the database for Active Record
gem 'railties','>= 5.1'
gem 'sqlite3','~> 1.4'
gem 'pg'
gem 'open_solidus_cloudinary',git: 'https://github.com/Berlimioz/open_solidus_cloudinary.git'
# Use Puma as the app server
gem 'puma','~> 4.1'
# Use SCSS for stylesheets
gem 'sassc-rails'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker','~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks','~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder','~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis','~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt','~> 3.1.7'
gem 'autoprefixer-rails'
gem 'font-awesome-sass','~> 5.6.1'
gem 'simple_form'
gem 'cloudinary','~> 1.1.7'
gem 'google-analytics-rails','~> 1.1','>= 1.1.1'
gem 'sitemap_generator'

gem 'solidus'
gem 'solidus_auth_devise'

gem 'solidus_i18n','~> 2.0'
gem 'rails-i18n','> 5.0'
gem 'kaminari-i18n','~> 0.5.0'
gem 'routing-filter','~> 0.6.0'
gem 'sprockets','= 3.7.2'
gem 'dotenv-rails'

# Use Active Storage variant
# gem 'image_processing','~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap','>= 1.4.2',require: false

group :development,:test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug',platforms: [:mri,:mingw,:x64_mingw]

end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console','>= 3.3.0'
  gem 'listen','~> 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen','~> 2.0.0'
  gem 'guard-livereload','~> 2.5',require: false
  gem 'rack-livereload'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara','>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files,so bundle the tzinfo-data gem
gem 'tzinfo-data',platforms: [:mingw,:mswin,:x64_mingw,:jruby]

任何帮助或想法将不胜感激!谢谢

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-