xxxxxxxxxx
Stop the development server (npm run commands) and then try to install package.
xxxxxxxxxx
npm cache clean --force
npm install -g npm@latest --force
Try to install your component once again.
xxxxxxxxxx
Stop your deployment server(Means your app shouldn't be running in the background on any port) and then try reinstalling. If still didnt work try clearing the cache via :
npm cache clean --force
npm install -g npm@latest --force
If u also use yarn
npm install -g yarn@latest --force