Can I Delete Package-lock or Yarn-lock File?
The short answer is No, you must not delete the package-lock or yarn-lock file, it is crucial for your project to work and compiled successfully without trouble. Here's the quick explanation, why you should not delete it.
Basically when you and some library with node package manager (npm) or yarn, you save it to your "package.json" and when you install your project, the package manager will try to grab some required other library by the library that you use and save it in a lock file when the building process is finished.
If you delete the lock file, the package manager you use will try to search it again, searching a newest dependencies that exist, because they can find the lock file. The lock file is basically just a massive dependencies list with the version that was work on last successful compiled.
It's still noticeable when your project is not that big, but when you have some bigger project that required a lot of dependencies, it can be really massive mess. Sometimes you got failure on building your project that you can even handle it, you try to search for online help but go no the right answer because it says the same error but not the same problem.
Keeping pacakge-log.json or yarn.lock will save your time, unless you are really skillful enough to fix one by one error because a breaking API used by your dependencies dependencies .