ReferenceError: i0 is not defined Angular AOT error

不打扰是莪最后的温柔 提交于 2019-12-13 03:46:32

问题


I have a local Angular git repository that I build using Angular AOT (4.4.4) and everything works when I copy and paste the results to the server. However, when I clone the repo and do the same commands everything works (all of the build steps) until I bring up the site after pasting the changes to the server and I get the following error before the site loads.

Error: Uncaught (in promise): ReferenceError: i0 is not defined ReferenceError: i0 is not defined at View_AppComponent_Host_0 (mywebsite/dist/build.js:1:4546206) at resolveDefinition (mywebsite/dist/build.js:1:104846) at n.create (mywebsite/dist/build.js:1:117593) at n.create (mywebsite/dist/build.js:1:55999) at n.bootstrap (mywebsite/dist/build.js:1:69345) at mywebsite/dist/build.js:1:66726 at Array.forEach () at n._moduleDoBootstrap (mywebsite/dist/build.js:1:66697) at mywebsite/dist/build.js:1:66172 at e.invoke (mywebsite/zone.min.js:1:19922) at Object.onInvoke (mywebsite/dist/build.js:1:59738) at e.invoke (mywebsite/zone.min.js:1:19862) at t.run (mywebsite/zone.min.js:1:15134) at mywebsite/zone.min.js:1:12167 at e.invokeTask (mywebsite/zone.min.js:1:20606) at new k (mywebsite/zone.min.js:1:12526) at h (mywebsite/zone.min.js:1:11644) at mywebsite/zone.min.js:1:12198 at e.invokeTask (mywebsite/zone.min.js:1:20606) at Object.onInvokeTask (mywebsite/dist/build.js:1:59640) at e.invokeTask (mywebsite/zone.min.js:1:20527) at t.runTask (mywebsite/zone.min.js:1:15783) at i (mywebsite/zone.min.js:1:10706) at

I tried doing some google searches and I think it has something to do with socket.io. I'm not using socket.io directly and it is hard to find anyone with a relatable issue. Any ideas why this error is occuring in a fresh repo clone with Angular AOT?


回答1:


My problem was in 'rollup' (used in the AOT build process). My version of rollup in 'package.json' was "^0.50.1".

See here: https://github.com/rollup/rollup/issues/1706 Apparently this was fixed in 0.51.3. My guess is it was a typo (should have been 'io')...

Current (2018-03-29) version of rollup is 0.57.1. So I updated my 'package.json' and ran 'npm install rollup'. Compiled and ran OK, but encountered the message: "Unknown input option: sourceMap" during build. Likely a deprecated option, so I deleted "sourceMap: false," from 'rollup.config.js'.

All good now.



来源:https://stackoverflow.com/questions/48777452/referenceerror-i0-is-not-defined-angular-aot-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!