Error: Cannot find module './internal/streams/stream'

Viewed 1550

I'm trying to add Sweetalert2 component in Angular to my project. When I put the npm install sweetalert2 in the terminal the following problem occurs:

Error: Cannot find module './internal/streams/stream'

and I don't know how to solve it.

This is the Error in the terminal:

This is the Error in the terminal

2 Answers

What worked for me was deleting the package-lock.json and the node_modules folder and then running

npm install

Then running:

npm install sweetalert2

Or if you don't want to deal with this one put the url of the cdn in the html file you request like this:

<script src="//cdn.jsdelivr.net/npm/sweetalert2@11"></script>
  1. Delete your node_modules by running:
rm -rf node_modules
  1. Delete your package-lock.json
  2. Clear your npm cache:
npm cache clean --force
  1. Run:
npm install
Related