shendepu / moqui-react-ssr-demo

Other
7 stars 3 forks source link

跑起来后报错 #2

Open abell123456 opened 7 years ago

abell123456 commented 7 years ago

SyntaxError: Invalid JSON: :1:0 Expected json literal but found <

^ 14:12:06.801 ERROR 108411398-15 o.moqui.i.c.r.FtlTemplateRenderer [Template Error: expression 'content' was null or not found (component://moqui-react-ssr-demo/screen/ReactSSRRoot/includes/index.html.ftl:16,43)] 14:12:06.803 INFO 108411398-15 o.m.i.s.ScreenRenderImpl apps/react-ssr-demo/counter/index.html [] in 4418ms (text/html;charset=utf-8) session node0hwa1f6hzjp63dpuxquwsf9e20 报上面这个错,不知道会不会影响。
abell123456 commented 7 years ago
<div id="root" style="height: 100%">[Template Error]</div>

果然有影响,页面渲染出错了。

shendepu commented 7 years ago

commit 0581f452b42a7b3952bfb58c61a2b2a65d509bd5 添加了null check, 页面渲染不报错了.

SyntaxError: Invalid JSON: :1:0 Expected json literal but found <是因为demo中使用了github的api, 估计react demo里面用的github token过期了, 所以Promise返回了html而不是json.

React应用里面用的是https://github.com/shendepu/react-redux-starter-kit/tree/moqui-react-ssr 里的代码, 你可以自己尝试下.