2

I am using some open source code that is a couple of years old to create a blog. The Source code was created using with Angular v 11 and an earlier version of Toastr to create error messages. I have Angular v 13 on my machine but haven't had any problems making the API for the project. Now I am getting this error when I try to build the front end after adding an error interceptor:

./node_modules/ngx-toastr/fesm2015/ngx-toastr.mjs - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js): TypeError: Cannot create property 'message' on string 'C:\Users\benja\CroweQuest\CroweQuest-UI\node_modules\ngx-toastr\fesm2015\ngx-toastr.mjs: This application depends upon a library published using Angular version 14.0.2, which requires Angular version 14.0.0 or newer to work correctly. Consider upgrading your application to use a more recent version of Angular.

If I upgrade to v 14 of Angular it gives me many other problems with the source code that I would not rather try to dig into to fix. I have tried going backward in Angular to v 11 but that didn't work. I also have tried to run npm --legacy-peer-deps, but that doesn't work either.

Is there a way to go back to an earlier version of Toastr?

Here are some full screenshots of the error: Screen shot of error

Second part of error screenshot.

Is there a way to go to an earlier version of Toastr, or how do you uninstall Toastr from your project? I have tried running npm uninstall toastr and it didn't work.

Thank you for any help you can give.

2 Answers 2

4

Find package.json and revert to "ngx-toastr": "^14.3.0" which is compatible with Angular 13. See here: https://stackblitz.com/edit/angular13-toastr-c55qqy?file=package.json

Delete node_modules before hand.

npm install ngx-toastr ^14.3.0 --save

Sign up to request clarification or add additional context in comments.

1 Comment

That worked perfectly! Thank you so much for your help. I had worked on it on my own for many hours.
2

The reason is your ngx-toastr version that doesn't work with your Angular version. enter image description here

Downgrade your ngx-toastr version into 14.3.0 with following commands:

  • Uninstall ngx-toastr dependency: npm uninstall ngx-toastr.
  • Install ngx-toastr v14.3.0: npm i [email protected].

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.