Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/63.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 未在生产中加载Rails资产_Ruby On Rails_Ruby_Ruby On Rails 4_Asset Pipeline_Assets - Fatal编程技术网

Ruby on rails 未在生产中加载Rails资产

Ruby on rails 未在生产中加载Rails资产,ruby-on-rails,ruby,ruby-on-rails-4,asset-pipeline,assets,Ruby On Rails,Ruby,Ruby On Rails 4,Asset Pipeline,Assets,我面临一个问题。当我在开发模式下运行应用程序时,始终运行良好,但当我在生产模式下运行应用程序时,资产未加载,请参阅生产中首页的源代码: <!DOCTYPE html> <html data-no-turbolink="true"> <head> <title> Se connecter - Tick{Master} </title> <link rel="stylesheet" medi

我面临一个问题。当我在开发模式下运行应用程序时,始终运行良好,但当我在生产模式下运行应用程序时,资产未加载,请参阅生产中首页的源代码:

<!DOCTYPE html>

<html data-no-turbolink="true">

  <head>
    <title>
      Se connecter - Tick{Master}
    </title>
    <link rel="stylesheet" media="all" href="/assets/application-58c87518596f09b30d0db6ec750f3465.css" />
    <script src="/assets/application-cd97d1e5bb179f9230219a04392157bd.js"></script>
<script src="/assets/chartkick-4936d4dfcc035e087fb36d935871a2b4.js"></script>
    <script src="/assets/jquery-ui.min-e79f6566871719060387f672b09e45e1.js"></script>
    <meta name="csrf-param" content="authenticity_token" />
<meta name="csrf-token" content="wem26VXIMznqlZhlDaFJP8xaikG0AXO6EyiQ4XB0sgpdO8ckH3yn1VE+2jeH2zfNfILre4rpcQAWOrLmE9Ci6A==" />
    <meta content="width=device-width, initial-scale=1" name="viewport">
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
    <link rel="shortcut icon" type="image/x-icon" href="/assets/favicon-b3a5a16fe1e9484cba7bf759cfd55098.ico" />
  </head>
和development.rb文件:

Rails.application.configure do
  config.cache_classes = false
  config.eager_load = false
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = true
  config.log_level = :debug
  config.active_support.deprecation = :log
  config.active_record.migration_error = :page_load
  config.assets.debug = true
  config.action_mailer.default_url_options = { host: '192.168.10.49:3000' }
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.serve_static_files = true
  config.assets.digest = true
  config.assets.raise_runtime_errors = true
end
对不起,代码太多,我的英语很差。。。谢谢你

编辑:在资产生产中出现此错误之前,我更新了链轮和指南针导轨,请参见Gemfile.lock的diff:

GIT
   - remote: git://github.com/Compass/compass-rails.git
   - revision: d600de4a6c5870613aac63f32491da4771a3c982
   + remote: https://github.com/Compass/compass-rails.git
   + revision: 86afb2c45ae329b3720be102c549612703e16402
   branch: master
   specs:
     - compass-rails (2.0.5)
     + compass-rails (3.0.2)
       compass (~> 1.0.0)
       sass-rails (< 5.1)
       - sprockets (< 2.13)
       + sprockets (< 4.0)

 GIT
   - remote: git://github.com/galetahub/ckeditor.git
   + remote: https://github.com/galetahub/ckeditor.git
   revision: 189d3c2bc9ec177947aec6932da03eb5a03f6879
   specs:
     ckeditor (4.2.0)
... ...
@@ -91,7 +91,7 @@ GEM
       railties (>= 3.0)
       sass-rails (>= 3.2)
     chronic (0.10.2)
     - chunky_png (1.3.4)
     + chunky_png (1.3.6)
     climate_control (0.0.3)
       activesupport (>= 3.0)
     cocaine (0.5.7)

我认为资产已经成功加载,在生产环境中,所有资产都连接在application.js和application.css中

 <script src="/assets/application-cd97d1e5bb179f9230219a04392157bd.js"></script>
 <link rel="stylesheet" media="all" href="/assets/application-58c87518596f09b30d0db6ec750f3465.css" />

运行
rake-assets:precompile
将更改迁移到这些文件(可能需要删除文件夹
public/assets/
,然后再次预编译)


只需使用此命令将资产预编译到生产环境中即可

您是否在生产环境中进行了
预编译
资产?当我这样做(使用--trace)时,它会在出现错误时失败:
Sass::SyntaxError:Undefined变量:“$background navbar connected jour”。(在/home/jeremy/TickMasterV2/app/assets/stylesheets/arrow\u up\u page.scss:15中)
我确认问题在于config.assets.precompile上的*.css。你需要更具体一点,否则它也会尝试编译sass部分。我修改了它,它可以很好地预编译,但是css/js中还有一个bug,我在开发模式中没有。你是否尝试在开发中预编译?我想我找到了解决方案,我知道为什么它会出现bug。。。。我刚刚在production.rb中输入了这一行:
config.assets.debug=true
,它就可以工作了。。。但我不知道为什么…:/你能解释一下吗?我通过一行一行地复制development.rb文件找到了解决方案,幸运的是它可以工作。。。
GIT
   - remote: git://github.com/Compass/compass-rails.git
   - revision: d600de4a6c5870613aac63f32491da4771a3c982
   + remote: https://github.com/Compass/compass-rails.git
   + revision: 86afb2c45ae329b3720be102c549612703e16402
   branch: master
   specs:
     - compass-rails (2.0.5)
     + compass-rails (3.0.2)
       compass (~> 1.0.0)
       sass-rails (< 5.1)
       - sprockets (< 2.13)
       + sprockets (< 4.0)

 GIT
   - remote: git://github.com/galetahub/ckeditor.git
   + remote: https://github.com/galetahub/ckeditor.git
   revision: 189d3c2bc9ec177947aec6932da03eb5a03f6879
   specs:
     ckeditor (4.2.0)
... ...
@@ -91,7 +91,7 @@ GEM
       railties (>= 3.0)
       sass-rails (>= 3.2)
     chronic (0.10.2)
     - chunky_png (1.3.4)
     + chunky_png (1.3.6)
     climate_control (0.0.3)
       activesupport (>= 3.0)
     cocaine (0.5.7)
Calling Element.createShadowRoot() for an element which already hosts a shadow root is deprecated. See https://www.chromestatus.com/features/4668884095336448 for more details.
VM8885:5 Uncaught TypeError: Cannot read property 'removeAttribute' of null(anonymous function) @ VM8885:5(anonymous function) @ VM8885:20
application-cd97d1e….js?body=1:12828 Uncaught Error: Highcharts error #16: www.highcharts.com/errors/16error @ application-cd97d1e….js?body=1:12828(anonymous function) @ application-cd97d1e….js?body=1:12837(anonymous function) @ application-cd97d1e….js?body=1:12729(anonymous function) @ application-cd97d1e….js?body=1:12731
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ cs-35843ed….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ da-73b51df….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ de-ch-7d771d0….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ de-8e0ecde….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ en-a9d8727….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ eo-5e7a3e9….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ eu-35cd319….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ fr-acfe202….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ gl-63c5f69….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ id-9e62b22….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ it-feed39f….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ km-1087fc8….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ ko-abbaf47….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ ku-1b74074….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ nb-89face1….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ nl-c88c3d7….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ pl-f2af2b5….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ pt-br-c6ad971….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ pt-46fe4b8….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ ru-6900c82….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ sv-21da89f….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ tr-9e8670e….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ ug-99d4085….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ uk-4c973cc….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ zh-cn-e827c9d….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ zh-7db9dc0….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ ar-9fb6d07….js?body=1:3
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ ca-ca4c6f9….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ da-608f9e7….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ de-1543f26….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ el-a9ae3ca….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ en-bf0f18b….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ es-9cc34d8….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ fi-05a9c0d….js?body=1:7
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ fr-4ae4717….js?body=1:3
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ he-01efbfd….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ hr-0836be2….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ it-d4ab984….js?body=1:7
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ jp-a0091b6….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ nl-ff90041….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ no-24d8642….js?body=1:2
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ pl-db55b30….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ pt-br-4abcb5f….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ pt-8d221ae….js?body=1:1
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ ru-7219f80….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ sv-083d4c2….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ tr-bca64f0….js?body=1:6
init-77b1ac4….js?body=1:246 Uncaught TypeError: Cannot read property 'langEntries' of nullCKEDITOR.plugins.setLang @ init-77b1ac4….js?body=1:246(anonymous function) @ zh-cn-b2bc918….js?body=1:6
1:2211 Uncaught TypeError: Notification.requestPermission is not a function(anonymous function) @ 1:2211
measureIt.js:120 Uncaught TypeError: Cannot read property 'create' of undefined(anonymous function) @ measureIt.js:120
 <script src="/assets/application-cd97d1e5bb179f9230219a04392157bd.js"></script>
 <link rel="stylesheet" media="all" href="/assets/application-58c87518596f09b30d0db6ec750f3465.css" />
rake assets:precompile RAILS_ENV=production