【问题标题】:Sencha app build production successfully,but the production page fails to load with .js not found errorSencha 应用构建生产成功,但生产页面无法加载 .js not found 错误
【发布时间】:2015-07-22 21:37:44
【问题描述】:

我正在使用 Extjs 5 、sencha cmd 5 和 extjs sencha 图表。

'app' 目录中我的应用程序的 index.html 工作正常,并且 sencha 应用程序构建成功。 当我去生产包加载生产index.html时,控制台给我错误'.js not found',日志如下:

GET http://localhost:8080/build/production/recommendation/.js?_dc=1431411762018 404 (Not Found)
  Ext.Boot.Ext.Boot.d.fetch 
  Ext.Boot.Ext.Boot.r.fetch 
  Ext.Boot.Ext.Boot.r.loadSync  
  Ext.Boot.Ext.Boot.r.load  
  Ext.Boot.Ext.Boot.k.loadEntries   
  Ext.Boot.Ext.Boot.d.processRequest    
  Ext.Boot.Ext.Boot.d.loadSync  
  Ext.Boot.Ext.Boot.d.load  
  Ext.apply.loadScripts 
  Ext.apply.load    
  Ext.apply.require 
  Ext.apply.syncRequire 
  Ext.Function.o.alias  
  Ext.ClassManager.Ext.apply.create 
  Ext.ClassManager.Ext.apply.instantiateByAlias 
  Ext.apply.factory 
  Ext.cmd.derive.applyAxes  
  k 
  Ext.Configurator.configure    
  Ext.Base.r.addMembers.initConfig  
  Ext.cmd.derive.constructor    
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  (anonymous function)  
  Ext.ClassManager.Ext.apply.create 
  Ext.cmd.derive.loginSuccess   
  Ext.widget.submit.success 
  Ext.apply.callback    
  Ext.cmd.derive.afterAction    
  Ext.cmd.derive.onSuccess  
  Ext.apply.callback    
  Ext.cmd.derive.onComplete 
  Ext.cmd.derive.onStateChange  
  Ext.Function.o.bind   
Uncaught TypeError: object is not a function
  (anonymous function)  
  Ext.ClassManager.Ext.apply.create 
  Ext.ClassManager.Ext.apply.instantiateByAlias 
  Ext.apply.factory 
  Ext.cmd.derive.applyAxes  
  k 
  Ext.Configurator.configure    
  Ext.Base.r.addMembers.initConfig  
  Ext.cmd.derive.constructor    
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  Ext.ClassManager.Ext.apply.widget 
  Ext.cmd.derive.create 
  Ext.cmd.derive.lookupComponent    
  Ext.cmd.derive.privates.prepareItems  
  Ext.cmd.derive.add    
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initItems  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.initComponent  
  Ext.cmd.derive.constructor    
  ai    
  (anonymous function)  
  Ext.ClassManager.Ext.apply.create 
  Ext.cmd.derive.loginSuccess   
  Ext.widget.submit.success 
  Ext.apply.callback    
  Ext.cmd.derive.afterAction    
  Ext.cmd.derive.onSuccess  
  Ext.apply.callback    
  Ext.cmd.derive.onComplete 
  Ext.cmd.derive.onStateChange  
  Ext.Function.o.bind   

我的 Extjs 版本是 5.1,我的 sencha cmd 版本是 5.1.3.61。 我已经用谷歌搜索了几个小时的答案。有些人建议使用“sencha app build testing”,我也成功测试了 build。我真的不知道我的应用程序问题出在哪里!

【问题讨论】:

  • 堆栈跟踪的第一行有一个“推荐”类,其中.js 在斜杠之后。你可能有一些拼写错误吗?或者可能缺少 require 依赖项。
  • 我确定缺少一些依赖项。问题是我不知道缺少哪个。开发模式下不会出现错误。建筑也成功了。
  • 在开发中,您是否在浏览器控制台中看到任何有关同步加载文件的日志?
  • 最后,我发现了缺少的东西!在测试包下调试即可','series.bar' 等...这些错误都是在测试模式下出现的!

标签: build sencha-cmd dev-to-production


【解决方案1】:

我推荐了here 以找到一种方法来定位问题所在。 正如它所说,在 sencha cmd 下使用“sencha app build testing”,并调试测试包以找出缺少的需求。 但是在这里我不得不提一下,为什么它在devMode下不需要别名'axis.numeric','axis.category','series.bar'的类就可以正常工作,而在生产模式和测试模式下却失败了!更糟糕的是,在生产模式下,框架反馈的只是“.js”未找到异常!

【讨论】:

    【解决方案2】:

    我最近遇到了同样的问题。生产构建成功,通过 htdocs 加载它显示 .js 文件 404 错误。

    请求网址:http://localhost/TFNextGen/.js?_dc=20170420113848 状态码:404 未找到

    解决方案:我的视图文件未包含在主门户文件中。所以我在 main.js 中的视图文件夹中包含所有与视图相关的 js 文件,之后它就像魅力一样工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-12
      • 1970-01-01
      • 1970-01-01
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多