网站运行时没有任何生产问题(文件缩小和连接),但是当页面发送到prerender.js或phantom.js进行快照时代,我得到一个错误:Angular无法为prerender.js/phantom.js加载模块仅用于生产
Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp to: Error: [$injector:modulerr] Failed to instantiate module myApp due to: Error: [$injector:nomod] Module 'myApp' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
https://www.mydomain.io/app/vendor.7240ef6a.js:4
https://www.mydomain.io/app/vendor.7240ef6a.js:3 in d
https://www.mydomain.io/app/vendor.7240ef6a.js:4 in m
https://www.mydomain.io/app/vendor.7240ef6a.js:4 in db
https://www.mydomain.io/app/vendor.7240ef6a.js:3 in g
https://www.mydomain.io/app/vendor.7240ef6a.js:3 in ea
https://www.mydomain.io/app/vendor.7240ef6a.js:3 in da
https://www.mydomain.io/app/vendor.7240ef6a.js:8
https://www.mydomain.io/app/vendor.7240ef6a.js:2 in j
https://www.mydomain.io/app/vendor.7240ef6a.js:2 in fireWith
https://www.mydomain.io/app/vendor.7240ef6a.js:2 in ready
https://www.mydomain.io/app/vendor.7240ef6a.js:1 in g
我必须文件:vendor.js和app.js.我在另一个项目上有完全相同的结构(只是这些文件是不同的),并且它与prerender.js服务器一样工作得很好。
我设法将问题追踪到jquery.js。但是我在这一点上陷入困境。看起来像prerender/phanatom.js以不同的方式加载文件。 A也使用window.prerenderReady = true/false
无济于事。我使用generator-angular-fullstack与角v1.5.8和jQuery V2.2.4
index.html中的jquery
前角被包括。我想知道是否有任何方法可以获得有关导致问题原因的更详细信息。
它只是幻影js或其他浏览器以及?听起来像依赖注入的问题。尝试使用'ng-app'在元素上添加'ng-strict-di',即'
' – maurycy您是否设法找到了解决方案?我有一个类似的问题。 –
这里同样的问题。你怎么修好它的?谢谢 – Hendrik