-
Notifications
You must be signed in to change notification settings - Fork 12k
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
"ERROR in Error: No NgModule metadata found for 'AppModule'." After Angular 5.2.1 and CLI 1.6.5 update #9292
Comments
I have faced same error. solved it: clean and reinstall global angular-cli and local angular. |
@keyant |
steps:
|
Tried @keyant 's steps but still got the error No NgModule metadata found for 'AppModule' |
I get this error seemingly random. Can't really see that I've changed anything and suddenly it just stops working and throws that error. As an example: I had a branch in Visual Studio Team Services that built correctly, and when I re-queued the same build, without any changes, the build didn't work anymore... |
What happens if you upgrade typescript to 2.6.0? |
Got the same error, in my case it is caused by an import statement: For instance following code report error when build.
And the error is gone if rewrite the code like below: |
@Albejr which commit covers this problem? https://github.com/angular/angular-cli/releases/tag/v1.6.6
|
Had the same experience earlier as Albejr, but with forEach. TS would fail to compile the code saying something like 'foreach is not a method of '... but if I left the hang compiler stuck, and changed and saved any TS file, the compile on top of the failed one would work. In other words, I could never run the program on the first compile. I got around it in other ways (sounds like foreach can have unpredictable results, so TS doesn't like it and so I moved to other means). The compiler behaviour made troubleshooting a problem more difficult... Using cli 1.6.7 I experienced the 'first compile fails' problem too. It was using the CoreUI framework which I'm still new to... before I could really test the problem, it went away. Perhaps a cache issue or something else, but the symptoms were exact as in my earlier case and as Alberjr describes. Something might still not be fully resolved on this front with 1.6.7... |
@x2361 |
I still have this problem with angular 5.2.4 and cli 1.6.7. I did npm cache clean --force, rm -rf node modules and package lock, remove webpack from package.json, fresh npm install and build. Still the problem persists. |
Update typescript of project to 2.6.2 solved it for me.
Took sooooo much time to figure out as the solution of deleting cli and cache and reinstalling them was working only partially. |
@vapits this solved my problem, excellent ! |
i also faced this error can any one give solution |
OMG i can't believe @Albejr solution worked for me. |
I finally resolved this issue. Resolution below. :-) Update the Angular CLI version to latest – as of today it’s 1.7.4 How to check the version of @angular/cli
Go to the folder and type the following commands to update CLI.
Make sure that the Webpack version is 3.11.0
How to update webpack
|
I have same problem ... I solved this problem only when remove globaly installed webpack.
|
I had the same problem (and the same effect, that the error went away when I edited any .ts file) and the problem was that I imported a module that was already exported via another imported module, like this (where FooSubModule is exported by FooModule):
It's strange in how many different cases this error message appears. More detailed error messages would be highly appreciated. |
I had a similar problem, but my problem was the name of the module when I was trying to load the module with lazy load. The first letter was in lowercase.
so I changed it like this and it works: |
In my case, what caused the problem was a wrongly defined module. I created a SecuredModule and lazy load that module. But I forgot that when you create a module in cli, it will also append the Module word. But sadly this error does not popup in 1.7.x version, instead I have to downgrade to 1.6.x to be able to figure out the problem. |
In my case, solved by deleting the node_modules folder , then running: |
I have the same issue when i update angular 2.x -> 6.x . I delete the package-lock.json and reinstall node_modules, it work fine now |
For me, I had an APP_INITIALIZER function/factory where the function was not "export"ed. Once I exported the function, it started working again. |
Hi compiler.js:11792 Uncaught Error: No NgModule metadata found for 'AppModule'. |
sudo npm install typescript@'>=2.4.2 <2.7.0' |
@Albejr your solution worked for me as well. Even programming languages works with horoscope magics!!!! |
@Albejr wth?? how i can llive now with this... helps me too! but its looks bad |
huge black box and no 'eject' available.. dance with a red eyes and daemons. sorry i am stucked for a while) |
can you post your 'tsconfig.app.json' |
Worked for me |
After having tried everything related to NPM, I got past this problem by which to me, totally makes zero sense 😬 👍 |
Same problem as @Albejr tks for the temp workaround This thinks make my job a special job, it's pretty like y car not start for a engine problem and y open and close the door and the car start work again. LOL |
I ran into this exact error. One of the angular modules I was importing (my own custom module) was being built with ng-packagr and was not exporting all of its services in |
I upgraded my project to Angular7 yesterday and have spent almost a day trying all possible solution but nothing works. I keep seeing thie message ERROR in No NgModule metadata found for 'AppModule'. The error happens after the success compilation of all assets. Changes made to tsconfig.json doesn't seem to affect the result in any way.
|
Just got this error, I'm on Windows 10. I upgraded angular-cli, core, and material to v7 to try out a new feature. Then I needed to switch to a branch that was still on v6 of everything. I did the following:
I even tried cloning the project into a new directory, doing npm install and then ng build, and got the same error. UPDATE |
Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we can't act on issues that are lacking important information. If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template. |
This worked for me, Thanks a ton @Albejr, you saved my day. |
Hello ! "include": ["./node_modules/cypress"] I removed it, following cypress recommendations, havint a file in the dedicated /cypress folder with that kind of content : { And now it does compile ! |
@Albejr thank you very much bro! |
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. |
Versions
Repro steps
ng s
Observed behavior
Desired behavior
App run normally
Mention any other details that might be useful (optional)
Application built and ran just fine before update.
Did try rm -rf node_modules and reinstall, no change.
The text was updated successfully, but these errors were encountered: