-
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
Uncaught (in promise) TypeError: e is not a constructor #9929
Comments
Hi, It will be so helpful if I get any clue Thanks |
I also encounter this issue with Angular CLI version 1.7.0. I remember I had a workaround by downgrading angular cli in package.json: "devDependencies": { But now seem like downgrading above also didn't work for me. |
waiting for solution.. |
+1 |
1 similar comment
+1 |
+1 |
the same problem in prod mode |
Try for this..
|
Same problem. Same result when compiling with --optimization=false. UPDATE: FURTHER UPDATE: |
I was able to run it with the --aot=false parameter too. |
Same issue. Fixed it by setting the --aot=false flag |
Hey! I was with the problem, you can try deleting node_modules and reinstalling the dependencies. |
+1 . Fixed with aot flag false but can't build in production mode without aot. |
i can run any idea what is the cause of this "@angular/cli": "^6.1.5", node version v8.11.4 |
i had the same issue with the dependencies works fine with |
These kinds of errors had plagued us for awhile. Yes you can turn off prod/aot compiles and you won't see the issue but then you won't have a minified/uglified/treeshaken optimized bits :) The most sane fix for us is to simply export * from any components that are causing the "ctor is not a constructor" (or similar) errors. So from your index.ts or however you do it you should say.... |
@Abdallah-khalil ng build --prod --sourcemaps --build-optimizer=false Please try and see if you can get to the library which is causing the error (helps to narrow down the issue) Thanks, |
Thanks @Mani2693 , |
I have the same problem after upgrading to angular 7- "dependencies": { Anybody can assist? |
It looks like not all reported errors here are the same. @Mani2693 would share minimum demo where we can reproduce the issue? |
@mgechev Thanks for your response , I am sorry I couldn't reproduce the issue in fiddler to share , Also for me I fixed the issue with "ng build --prod --sourcemaps --build-optimizer=false" which helps to narrow down to the library causing issue ( This library is our own created using ng-packagr ) Thanks again Regard, |
@Mani2693 thanks for sharing your findings! Maybe you can work with @dherges on fixing the issue. |
Hi I have the same problem with Angular7 and prod mode. If i don't compile with optimizations the error changes in "ctor is not a constructor". Any help? |
Same here: --aot=false works but it is rather nasty to do. We are not sure since what change on our side the error occurs but if we find something, I will comment back here. |
I'm experiencing the exact same issue - some components cannot be created because of "is not a constructor" error in prod mode with 7.2. This should be reopened. |
I'm experiencing the exact same issue - some components cannot be created because of "is not a constructor" error in prod mode with 7.3. This should be reopened. |
Same problem "o is not a constructor" when build without --aot=false --build-optimizer=false |
Just to update that after deleting the node modules directory and running npm install, it worked! |
Resolved by update Angular CLI |
I am still seeing this issue. This issue should be reopened. |
Looks like this is related to the bundle optimizer. @filipesilva any thoughts? |
I think it would be better to close to issue and open a new one with a reproduction so that we could investigate. The original issue was for Angular CLI 1.7.3, and I feel pretty confident the reproduction doesn't apply because otherwise all apps that use the router would be broken. We do test the router in many places so I don't think that holds true. There have been other reports of the same error message across versions, but the same error message doesn't mean it's the same issue. Different problems might show the same error message. There are also reports of updating, reinstalling nodes modules, or using different flag combinations removing the error So I think it's very hard to say anything definitive about this issue with so many different and conflicting reports and no reproduction. It is better to make a new issue with actionable information than to continue here. |
The common theme is we can't run with the artifacts from build:production. |
@kathygit we'd really like to fix the problem you're seeing but we can't do it without some sort of reproduction. We talk a little in https://github.com/angular/angular-cli/blob/master/CONTRIBUTING.md#-submitting-an-issue about why it's important to have a reproduction. Can you spare some time to open a new issue with a reproduction so we can dig in and fix the problem? |
@filipesilva I've created a similar bug with some more info: #13540 Mybe this can help. |
@krojew reading through that issue it sounds like it was some sort of problem with I agree it would be nice if there was a build error for it instead of breaking at runtime, but that's not always possible. Sometimes code isn't statically analysable for errors. If I had to bet it was something that broke when using minification, which is part of prod builds. |
@filipesilva yes - it was a AOT incompatibility which was fixed. But that gives you a repeatable case to see what's actually going on and if it's possible to catch it at compile time. |
I had a similar issue with an NPM module I was consuming. The NPM module code was like this: // my-service.js
export default class MyService {} // <-- default export
// index.js
import MyService from './my-service'
export { MyService }; The fix was to export the class instead of exporting default: // my-service.js
export class MyService {} // <-- exporting the class
// index.js
import { MyService } from './myService'; // <-- destructured import
export { MyService }; |
I can support BBlackwo, in my case I had implemented a CustomUrlSerializer like so:
Removing the default Keyword fixed the issue:
|
Guys, if any of you still have this problem, I recommend checking your npm packages. In my case, I had a npm warn of a missing dependency and when I fixed this warn my problem was solved. |
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. |
Version:
Error
Repro steps
Package.json
Background
Mention any other details that might be useful (optional)
Below function in zone.js is where the error thrown:
try catch which returns the error:
Hope the information helps, Please look into this issue ASAP since we need this to be sorted out very quickly
Thanks in advance
The text was updated successfully, but these errors were encountered: