Monirul Islam
Monirul Islam

Reputation: 312

Angular JS ngx-toastr Error: Module not found: Error: Package path ./public_api is not exported from package

./src/app/nav/nav.component.ts:5:0-44 - Error: Module not found: Error: Package path ./public_api is not exported from package C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr (see exports field in C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr\package.json)

./src/app/register/register.component.ts:4:0-55 - Error: Module not found: Error: Package path ./toastr/toastr.service is not exported from package C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr (see exports field in C:\Users\Score\demo\DatingApp\client\node_modules\ngx-toastr\package.json) [1]: https://i.sstatic.net/WaZNB.png

Upvotes: 3

Views: 2281

Answers (3)

kalmur
kalmur

Reputation: 1

I had the same problem. I uninstalled the version I had and instead, I used this command to install the older version:

npm i [email protected]

Hope that solves it for you!

Upvotes: 0

Ajinkya H Jagadale
Ajinkya H Jagadale

Reputation: 21

import toastService in your service file like this:

import { ToastrService } from 'ngx-toastr';

Upvotes: 2

Monirul Islam
Monirul Islam

Reputation: 312

Use this

import { ToastrService } from 'ngx-toastr';

Instade of

import { ToastrService } from 'ngx-toastr/public_api';
import { ToastrService } from 'ngx-toastr/toastr/toastr.service';

Upvotes: 5

Related Questions