“ Zone已经加载” Angular Universal SSR

时间:2019-07-26 05:35:46

标签: node.js angular npm angular6 serverside-rendering

目前,我正在从事一个有角度的项目。我想为我的项目做服务器端渲染。因此,我使用角度通用来实现这一目标。我的浏览器模块构建成功,但是当服务器构建正在运行时,我遇到了这个问题。

    > ngx-admin@2.3.0 serve:ssr /var/www/html/testproject/testprojectAngular
> node dist/server

/var/www/html/testproject/testprojectAngular/dist/server.js:59430
        throw new Error('Zone already loaded.');
        ^

Error: Zone already loaded.
    at /var/www/html/testproject/testprojectAngular/dist/server.js:59430:15
    at /var/www/html/testproject/testprojectAngular/dist/server.js:60042:3
    at FUNCTION (/var/www/html/testproject/testprojectAngular/dist/server.js:59408:10)
    at Object.<anonymous> (/var/www/html/testproject/testprojectAngular/dist/server.js:59410:2)
    at __webpack_require__ (/var/www/html/testproject/testprojectAngular/dist/server.js:59292:30)
    at Object.<anonymous> (/var/www/html/testproject/testprojectAngular/dist/server.js:59355:1)
    at __webpack_require__ (/var/www/html/testproject/testprojectAngular/dist/server.js:59292:30)
    at Object.defineProperty.value (/var/www/html/testproject/testprojectAngular/dist/server.js:59344:18)
    at Object.<anonymous> (/var/www/html/testproject/testprojectAngular/dist/server.js:59347:10)
    at __webpack_require__ (/var/www/html/testproject/testprojectAngular/dist/server.js:23:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ngx-admin@2.3.0 serve:ssr: `node dist/server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the ngx-admin@2.3.0 serve:ssr script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/sys9/.npm/_logs/2019-07-26T05_19_29_348Z-debug.log

我不知道为什么会引起这个问题。任何帮助都是可观的。注意:我不使用Firebase。

1 个答案:

答案 0 :(得分:0)

您好,您可以将截图和索引文件放在一起吗? 并确保您不会两次在索引html中加载模块