angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Cannot read property 'kind' of undefined for ng add @nguniversal/express-engine

Open nnworkspace opened this issue 7 years ago β€’ 6 comments

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [x] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

This used to work with Angular CLI v8.0

Description

Trying to use Angular Universal.

The add command:

ng add @nguniversal/express-engine --clientProject my-project

simply failed to create the file app.server.module.ts with the message:

Cannot read property 'kind' of undefined

πŸ”¬ Minimal Reproduction

  1. Simply grab an Angular project which does not use Angular Universal yet
  2. cd into the project root, and run this command:
ng add @nguniversal/express-engine --clientProject my-project

πŸ”₯ Exception or Error

The command above terminated with this message:


Installed packages for tooling via npm.
Cannot read property 'kind' of undefined

🌍 Your Environment


Angular CLI: 8.3.3
Node: 10.16.0
OS: win32 x64
Angular: 8.2.5
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.3
@angular-devkit/build-angular     0.801.3
@angular-devkit/build-optimizer   0.801.3
@angular-devkit/build-webpack     0.801.3
@angular-devkit/core              8.1.3
@angular-devkit/schematics        8.3.3
@angular/cdk                      8.2.0
@angular/cli                      8.3.3
@angular/flex-layout              8.0.0-beta.27
@angular/material                 8.2.0
@ngtools/webpack                  8.1.3
@nguniversal/express-engine       8.1.1
@schematics/angular               8.3.3
@schematics/update                0.803.3
rxjs                              6.5.3
typescript                        3.4.5
webpack                           4.35.2

nnworkspace avatar Sep 11 '19 07:09 nnworkspace

Hi @nnworkspace, would you be able to share a reproduction? I tried this on a newly generated project but I was unable to replicate it.

Installed packages for tooling via npm.
CREATE src/main.server.ts (361 bytes)
CREATE src/app/app.server.module.ts (427 bytes)
CREATE tsconfig.server.json (273 bytes)
CREATE webpack.server.config.js (1466 bytes)
CREATE server.ts (1980 bytes)
UPDATE package.json (1857 bytes)
UPDATE angular.json (4385 bytes)
UPDATE src/main.ts (432 bytes)
UPDATE src/app/app.module.ts (359 bytes)
added 30 packages from 28 contributors and audited 20975 packages in 6.991s
found 0 vulnerabilities

audited 20975 packages in 5.82s
found 0 vulnerabilities

Thanks

alan-agius4 avatar Sep 11 '19 13:09 alan-agius4

Hi Alan,

could you please try to run the add nguniversal/express-engine command on this project (packed in a zip file)? This failed with latest Angular-related packages on my machine. Thanks!

@alan-agius4

nnworkspace avatar Sep 15 '19 11:09 nnworkspace

This error should be obsolete in version 9.

Can you try the below

ng add @nguniversal/express-engine@next --client-project=foo

alan-agius4 avatar Sep 17 '19 17:09 alan-agius4

Closing as this has been in the v9.0.0-next.1 of '@nguniversal/express-engine`.

Kindly note that issues related to @nguniversal packages should be created in their issue tracker https://github.com/angular/universal/issues

alan-agius4 avatar Sep 26 '19 11:09 alan-agius4

This error should be obsolete in version 9.

Can you try the below

ng add @nguniversal/express-engine@next --client-project=foo

Hi @alan-agius4

This worked for me very well, thank you very much!

nn

nnworkspace avatar Sep 27 '19 11:09 nnworkspace

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.