question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Unexpected value. Please add a @NgModule annotation.

See original GitHub issue

🐞 Bug report

Command (mark with an x)

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

Is this a regression?

Not, this is a older problem, i reported previusly in angular/angular-cli#13006 without providing a repo.

Description

I receive a Unexpected value 'LayoutModule' error when building a library with a single NgModule dependency (one NgModule depends on other).

πŸ”¬ Minimal Reproduction

This repo contains a minimal example of the issue: https://github.com/prodisign/bug-reporting ng build rh

πŸ”₯ Exception or Error


------------------------------------------------------------------------------
Building entry point '@prodisign/rh/model/client'
------------------------------------------------------------------------------
Compiling TypeScript sources through ngc
ERROR: Unexpected value 'LayoutModule in /home/jdavidls/Proyectos/prodisign/experiments/prodisign-workspace/dist/prodisign/rh/client/prodisign-rh-client.d.ts' imported by the module 'ModelModule in /home/jdavidls/Proyectos/prodisign/experiments/prodisign-workspace/projects/prodisign/rh/model/client/src/ModelModule.ts'. Please add a @NgModule annotation.

An unhandled exception occurred: Unexpected value 'LayoutModule in /home/jdavidls/Proyectos/prodisign/experiments/prodisign-workspace/dist/prodisign/rh/client/prodisign-rh-client.d.ts' imported by the module 'ModelModule in /home/jdavidls/Proyectos/prodisign/experiments/prodisign-workspace/projects/prodisign/rh/model/client/src/ModelModule.ts'. Please add a @NgModule annotation.

See "/tmp/ng-1Uj8ei/angular-errors.log" for further details.

🌍 Your Environment


Angular CLI: 8.3.18
Node: 10.15.3
OS: linux x64
Angular: 8.2.13
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.803.18
@angular-devkit/build-angular      0.803.18
@angular-devkit/build-ng-packagr   0.803.18
@angular-devkit/build-optimizer    0.803.18
@angular-devkit/build-webpack      0.803.18
@angular-devkit/core               8.3.18
@angular-devkit/schematics         8.3.18
@angular/cli                       8.3.18
@ngtools/webpack                   8.3.18
@schematics/angular                8.3.18
@schematics/update                 0.803.18
ng-packagr                         *5.7.1*
rxjs                               6.4.0
typescript                         3.5.3
webpack                            4.39.2

Edit: In the repo, I am using a complex module disposition, doing use of secondary entrypoints. But other simplest dispositions throwns the same error.

Im reported the same issue at https://github.com/ng-packagr/ng-packagr/issues/1444.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
alan-agius4commented, Nov 11, 2019

@IgorMinar i am going to remove the ivy and ngcc labels as this is a bug in the VE metadata bundler.

1reaction
alan-agius4commented, Nov 11, 2019

This seems related to barrel files.

In projects/prodisign/rh/client/src/public_api.ts change export * from './layout to export * from './layout/index';

I am moving this to the FW repo as it’s a compiler bug.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected value 'ButtonModule Please add a @NgModule ...
i have made a UI Library in Angular 8 and am using this library into my another custom library, But when am importing...
Read more >
Javascript – Unexpected value '…' imported by the module ...
imported by the module 'AppModule'. Please add a @NgModule annotation. I've tried: Clearing my npm cache; Re-installing all node modules; Forcing all AngularΒ ......
Read more >
Unexpected value 'ButtonModule Please add a @NgModule ...
[Solved]-Unexpected value 'ButtonModule Please add a @NgModule annotation-angular.js ... You need to export and import the files explicitly. If it's a module fileΒ ......
Read more >
Angular Error on build: 'Please add a @NgModule annotation'
ERROR in : Unexpected value 'SpreadSheetsModule in E:/misc/misc2/src/assets/spread/gc.spread.sheets.angular.11.1.3.d.ts' imported by theΒ ...
Read more >
Angular Noob here - what does "Please add a @NgModule ...
Just a quick note: always check for dependencies when upgrading. In my experience, the error you got means, you haven't added a component...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found