-
Notifications
You must be signed in to change notification settings - Fork 12k
Component library local development with npm link error: "Please add a @NgModule annotation" #6505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You can find information related to using linked libraries here: https://github.com/angular/angular-cli/wiki/stories-linked-library If you are still having issues, please let us know and if possible provide a sample library or other repro. |
@clydin thanks, I still have issues. I believe my component library follows the guidelines from the link you provided. I attach a zip file with a sample library and an angular-cli application using it which can be used to reproduce the issue: |
Your component library setup looks fine.
|
Great. That fixes it. I can see now that it was also explained in the guide you provided earlier but I didn't understand it there. |
Adding I've followed all of the steps in the guide carefully, but I must be missing something because I always get the error. |
I have the same issue, but only in development, the result of the production compile run works just fine.
|
deleting the node_modules folder from linking library solved the error for me |
I am having the same issue when i try to link a module after running ngc. The issue goes away if i use "@angular/cli": "1.2.7" but if i use 1.3.0 and up to 1.4.7 i have the issue where i am asked to "Please add a @NgModule annotation." in the console of the browser. any ideas? node -v
|
@endy21osu Hi Jeff - you can try removing the linked library's See also this issue |
Hi Matt, Thanks for the response. If you are talking about the node_modules folder that might be in the dist folder after running ngc then yes I did delete that. Is there a different one i should be deleting? |
It will be the |
@endy21osu, I explained how I fix it here: angular/angular#15763 (comment), I hope it can help you... |
Here i tried to elaborate more on the problem: #2154 (comment) |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug Report or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.0.6
node: 6.9.5
os: win32 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.6
@angular/compiler-cli: 4.1.3
Repro steps.
ngc -p ./src/tsconfig.lib.json
npm link
at the/dist
folder of the library.npm link component-library-package-name
ng serve
.Unexpected value 'MyModule' imported by the module 'AppModule'. Please add a @NgModule annotation.
The log given by the failure.
Chrome error log:
Desired functionality.
Mention any other details that might be useful.
The text was updated successfully, but these errors were encountered: