The package-lock.json sets your currently installed version of each package in stone and npm will use those exact versions when running npm install
When the dependency versions are corrupted, it leads to this error. It can be resolved easily by resetting the dependencies and installing afresh
Verify whether package–lock.json is created and node_modules folder is added to your project