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.

"Please add a @NgModule annotation" error in 1.0.4. Works in 1.0.3.

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

@angular/cli: 1.0.4
node: 6.10.0
os: darwin x64
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.0.4
@angular/compiler-cli: 4.1.3

Repro steps.

  1. Clone this sample module, which allegedly uses the current recommended Angular package format: https://github.com/jasonaden/simple-ui-lib
  2. Create new test app with: ng new testApp
  3. Build simple-ui-lib with sh build.sh
  4. npm link simple-ui-lib’s /dist
  5. Go to the testApp and npm link simple-ui-lib
  6. Import the module in testApp: import { BoxModule } from 'simple-ui-lib';
  7. Add BoxModule to the imports in testApp’s app module

The log given by the failure.

compiler.es5.js:1540 Uncaught Error: Unexpected value ‘BoxModule’ imported by the module ‘AppModule’. Please add a @NgModule annotation. at syntaxError (http://localhost:4200/vendor.bundle.js:29714:34) at http://localhost:4200/vendor.bundle.js:42668:44 at Array.forEach (native) at CompileMetadataResolver.getNgModuleMetadata (http://localhost:4200/vendor.bundle.js:42651:49) at JitCompiler._loadModules (http://localhost:4200/vendor.bundle.js:53804:66) at JitCompiler.compileModuleAndComponents (http://localhost:4200/vendor.bundle.js:53763:52) at JitCompiler.compileModuleAsync (http://localhost:4200/vendor.bundle.js:53725:23) at PlatformRef.bootstrapModuleWithZone (http://localhost:4200/vendor.bundle.js:5731:25) at PlatformRef.bootstrapModule (http://localhost:4200/vendor.bundle.js:5717:21) at Object.116 (http://localhost:4200/main.bundle.js:117:124)

Desired functionality.

I’d assume that since this error spawns from both the recommended package setup, and a default new CLI application, that it should run with no errors right out of the box.

Mention any other details that might be useful.

This works in 1.0.3, but breaks in 1.0.4. (Broken in 1.1.0-rc.0 as well.) Not sure if this is actually a bug, or some change in how Angular CLI expects outside modules to be built.

Issue Analytics

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

github_iconTop GitHub Comments

4reactions
clydincommented, May 23, 2017

For details on using a linked library, please see this new developer story: https://github.com/angular/angular-cli/blob/master/docs/documentation/stories/linked-library.md

0reactions
angular-automatic-lock-bot[bot]commented, Sep 8, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular error: Please add a @NgModule annotation
You're trying to "import" a component in SomeModule . imports: [ CommonModule, SomeComponent ],. You import modules and declare components, ...
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 >
Angular 4 でマテリアルデザインを使う データバインディング編
"Please add a @NgModule annotation" error in 1.0.4. Works in 1.0.3. Angular 4 でマテリアルデザインを使う.
Read more >
Open Source Used In slido-test 22.06 - Cisco
In your requests please include the following reference number 78EE117C99- ... Work and for which the editorial revisions, annotations, elaborations, ...
Read more >
Error message Is it missing @NgModule annotation? NG6002
https://codedocu.com/Net-Framework/ASP_dot_Net-Core/Angular/ Errors /Angular-Error_colon_-Is-it-missing-an-@ NgModule - annotation ?2672Error ...
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