简体   繁体   English

Rails6:部署后应用程序显示 SyntaxError: Unexpected token 'export'

[英]Rails6: Post deployment application shows SyntaxError: Unexpected token 'export'

The application was working perfectly fine till the latest deployment which started showing error in Developers Tools and on every tab that I try to click in the application.该应用程序运行良好,直到最新部署开始在开发人员工具和我尝试在应用程序中单击的每个选项卡上显示错误。

Deployment is done trough Capistrano通过Capistrano完成部署

Uncaught SyntaxError: Unexpected token 'export' (at application-00b7157c7.js:44883:1)
(index):261 Uncaught ReferenceError: $ is not defined
    at (index):261:1
(anonymous) @ (index):261
(index):268 Uncaught ReferenceError: $ is not defined
    at (index):268:5
(anonymous) @ (index):268
(index):285 Uncaught ReferenceError: $ is not defined
    at (index):285:5

This is where the error is thrown ->这是引发错误的地方->

$.ajaxSetup({
  headers: {
    'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content')
  }
});  

Javascript Version -> Javascript版本->

Ext.getVersion('extjs');
constructor {shortVersion: '421883', version: '4.2.1.883'

JQuery is a part of application.js JQuery 是 application.js 的一部分

//
//= require jquery
//= require jquery_ujs
//= require js/bootstrap.min
//= require js/ekko-lightbox.min
//= require jquery.placeholder
//= require jquery-ui

Does anyone know what is causing this?有谁知道是什么原因造成的?

My Gemfile was at -> jquery-rails (4.4.0) which got upgraded to jquery-rails (4.5.0)during deployment.我的 Gemfile 位于 -> jquery-rails (4.4.0),在部署期间升级到 jquery-rails (4.5.0)。 I changed my Gemfile to restrict the jQuery version gem 'jquery-rails', '4.4.0' which fixed this problem我更改了我的 Gemfile 以限制 jQuery 版本 gem 'jquery-rails', '4.4.0' 解决了这个问题

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM