Skip to content

error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class. #5043

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

Closed
3 tasks done
DerZyklop opened this issue May 5, 2022 · 3 comments

Comments

@DerZyklop
Copy link

DerZyklop commented May 5, 2022

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/angular

SDK Version

6.19.7

Framework Version

6.19.7

Link to Sentry event

No response

Steps to Reproduce

Install TraceModule like this:

import * as Sentry from '@sentry/angular';


@NgModule({
	imports: [
		Sentry.TraceModule,
		
	],
	
	providers: [
		{
			provide: Sentry.TraceService,
			deps: [Router],
		},
		{
			provide: APP_INITIALIZER,
			useFactory: () => () => {},
			deps: [Sentry.TraceService],
			multi: true,
		},
	]
});
export class AppModule {}

Expected Result

No Error.

Actual Result

Error:

Error: node_modules/@sentry/angular/build/types/tracing.d.ts:51:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.

This likely means that the library (@sentry/angular) which declares TraceModule has not been processed correctly by ngcc, or is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

@Lms24
Copy link
Member

Lms24 commented May 5, 2022

Hi @DerZyklop

I believe this is very much related to #3282 which resulted in #4644. We recently merged the compiler change into 7.x and it was released with @sentry/[email protected]. So you're in luck - you could just check out the beta version and TraceModule should work for you. Actually, it would be great to get some feedback on the v7 Angular SDK.

If you need to wait for the stable version of v7, it shouldn't take too long (famous last words lol).

Just out of curiosity, which Angular version are you using?

Hope this helps, have a nice day!

@DerZyklop
Copy link
Author

Can not test it right now. Not at work. But to satisfy your curiosity: Angular version is the latest v12.

@Lms24
Copy link
Member

Lms24 commented May 30, 2022

Small Update: v7 was just released, so you're safe to update to a stable version with the Angular fix once you have time.
(Angular 12 should work with our Angular SDK)

@Lms24 Lms24 closed this as completed May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants