Deploying Angular2 App, getting unknown non-descriptive error

喜夏-厌秋 提交于 2020-01-17 04:03:46

问题


Getting this error in firebug after angular2 app has been deployed : "TypeError: this._nativeError is undefined" in app.js.

*app.js is the javascript that is created from npm run build.prod.aot (and also npm run build.prod).

App runs fine locally, it only seems to give me problems after I've deployed to a standalone web server. I assume I have a minor typo somewhere, but the error looks pretty generic and I can't find anything conclusive as to what might be the cause.

Has anyone seen this issue before? Or have any idea how to narrow down my search in finding it?

Edit: Using this seed project: https://github.com/mgechev/angular-seed but comments/answers are suggesting that others have had issue despite using other starters


回答1:


Around line 1604 in the compiler.umd.js I added a console.log to show me the message.

It is part of the set function of the Object.defineProperty(BaseError.prototype, "message" definition.

The setter is assigning the message to the _nativeError.message, but _nativeError is undefined and thus, THAT was blowing up, hiding the REAL error message.

So, I just put a console.log to spit out the message that was being passed in, and it showed me the actual error I had (a template error).

Therefore, this appears to be a bug in their code.

Hope that helps.




回答2:


Thanks!!! For me it simply worked without uninstalling but just simply installing: npm install zone.js@0.72 - Than node_modules/zone.js/package.json contained _id 0.7.2 rather than 0.7.5 and the error messages became as beautifull as before




回答3:


I had the same error: "TypeError: this._nativeError is undefined", but I do not use angular-seed.

My stack trace:

.set
    assignAll
    ZoneAwareError
    BaseError
    SyntaxError
    CompileMetadataResolver.prototype._getDependenciesMetadata
    CompileMetadataResolver.prototype._getTypeMetadata
...

The error was removed after setting: "emitDecoratorMetadata": true in tsconfig.json.




回答4:


I had the same problem and same message. It is a known issue to zone.js version 0.7.5 that the actual error messages are not displayed properly - see also here: Github Issues on zone.js 0.7.5 First I thought, I had version 0.7.2 because the package manager showed me that I had, but I tried and deinstalled with npm, afterwards installed 0.7.2 and now I have a beautiful error message pointing me directly on the nose of the error :) Hope that helps you, too.



来源:https://stackoverflow.com/questions/41627916/deploying-angular2-app-getting-unknown-non-descriptive-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!