Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Module not found: Error: Resolving to directories is not possible with the exports field (request was ./)

I upgraded angular from v11 to v12. I am getting this error and I dont know why. there are no changes in build configuration or tsconfig.

like image 574
Nabeel Hassan Avatar asked Nov 23 '25 22:11

Nabeel Hassan


2 Answers

Simple example

Wrong import { BehaviorSubject } from 'rxjs/';

Correct import { BehaviorSubject } from 'rxjs';

I faced this issue during a migration. Search for something similar in your code to fix the issue. In my case the component causing the issue was mentioned in the error message.

like image 87
Thomas Renger Avatar answered Nov 26 '25 11:11

Thomas Renger


import { HttpClientModule } from '@angular/common/http/';

just remove / from last of your import as Thomas Renger mentioned above.

like this

import { HttpClientModule } from '@angular/common/http';

like image 37
RAHUL Avatar answered Nov 26 '25 12:11

RAHUL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!