【问题标题】:Ember build errorEmber 构建错误
【发布时间】:2016-05-20 14:51:16
【问题描述】:

当运行ember build --environment=production 时,一切似乎都编译得很好。将文件放入服务器上的dist/ 也可以,但是当我单击页面上的链接时,出现以下错误:

      vendor-ef159bc….js:11 Error while processing route: account Unexpected token < in JSON at position 0 SyntaxError: Unexpected token < in JSON at position 0
at Object.parse (native)
at ae.parseJSON (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:3:12644)
at W (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:1:15665)
at n (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:3:13996)
at XMLHttpRequest.<anonymous> (http://localhost:8000/assets/vendor-ef159bc608efff575c24c5e13c2d1218.js:3:20168)`.

我做错了什么?

【问题讨论】:

  • 你能提供一个非工作项目吗?
  • 通常在期待 JSON 而看到 Unexpected token &lt; in JSON at position 0 时,这表明您正在检索 HTML 而不是 JSON。当您收到此错误时,我会使用 REST 客户端来检索该 URL,这应该会为您提供有关为什么会发生这种情况的线索。
  • Wells 是 vendor.js 文件。所以它可能是js。但我的意思是一个 git repo,这个问题是可以重现的。
  • 嗯,奇怪的是它在开发模式下工作,而不是在为生产构建它时
  • 是的。在生产模式下不起作用。面临同样的问题。有什么解决办法吗?

标签: javascript json ember.js routing


【解决方案1】:

我最近解决了类似的问题,方法是在 bower.json 中从 jQuery 2 降级到 jQuery 1,然后删除 bower_components 中的 jQuery 文件夹,然后运行bower install 命令。

【讨论】:

  • 您能找到解决方案吗?
  • @PiyushChoudhary 从那以后我就没碰过 Ember,你呢?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多