angular 通用甚至在空项目上也不起作用

angular universal not working even on empty project

我只是使用

构建它
ng new test-ssr
cd test-ssr
ng add @nguniversal/express-engine --clientProject test-ssr
npm run build:ssr
npm run serve:ssr

当我转到 localhost:4000 时,它显示

Error: You must pass in a NgModule or NgModuleFactory to be bootstrapped
    at View.engine (C:\Users\rober\ng\test-ssr\dist\server.js:39238:23)
    at View.render (C:\Users\rober\ng\test-ssr\dist\server.js:123884:8)
    at tryRender (C:\Users\rober\ng\test-ssr\dist\server.js:121592:10)
    at Function.render (C:\Users\rober\ng\test-ssr\dist\server.js:121544:3)
    at ServerResponse.render (C:\Users\rober\ng\test-ssr\dist\server.js:130425:7)
    at C:\Users\rober\ng\test-ssr\dist\server.js:135:9
    at Layer.handle [as handle_request] (C:\Users\rober\ng\test-ssr\dist\server.js:123312:5)
    at next (C:\Users\rober\ng\test-ssr\dist\server.js:123060:13)
    at Route.dispatch (C:\Users\rober\ng\test-ssr\dist\server.js:123035:3)
    at Layer.handle [as handle_request] (C:\Users\rober\ng\test-ssr\dist\server.js:123312:5)

使用 ng update --all --force 更新了所有依赖项,然后 npm i typescript@">=3.1.1 <3.3" 也没有解决任何问题(之前和之后都尝试过)

注意 运行 npm start 和打开 localhost:4200 仍然正常工作

你可以在这里看到我的版本 https://github.com/robertisaacBBN/ng-ssr

这是 angular

的问题

只需运行npm i @angular-devkit/build-angular@0.13.4即可解决问题

请参阅 https://github.com/angular/angular-cli/issues/13865 以跟踪问题