2

./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.stack.imgur.com/WaZNB.png

Monirul Islam
  • 178
  • 1
  • 9

3 Answers3

6

Use this

import { ToastrService } from 'ngx-toastr';

Instade of

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

Monirul Islam
  • 178
  • 1
  • 9
2

import toastService in your service file like this:

import { ToastrService } from 'ngx-toastr';

0

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

npm i ngx-toastr@14.3.0

Hope that solves it for you!

Fedor
  • 17,146
  • 13
  • 40
  • 131
kalmur
  • 1