Yarn has created yarn.lock
and yarn-error.log
.
I have been told not to add yarn.lock
to my .gitignore
file because it locks down the packages.
Should I ignore the latter?
It makes sense to ignore the yarn-error.log
—log files are only useful to debug your own copy of the code, so there's no need to upload it to the repository.
File should be uploaded to your repo when they are useful or needed to build your project. The yarn-error.log
(as the name suggests) is an error log, so it's never read by Yarn. The whole point of it is that you read the log to find out what went wrong, and if you've not had any errors, it might not even exist at all.
gitignore.io, a service which generates .gitignore
files, include yarn-error.log
and yarn-debug.log
in their .gitignore
file for Node:
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
It may be wise to follow their example if you're not sure what you need—most pre-made .gitignore
files have thought this issue through and concluded that logs should generally be ignored.
Since writing this I realise all log files are typically ignored in the .gitignore file with this entry:
*.log
some times we find error that is "cannot find symbol" when build the project. to solve that problem we add this file to our root project.
we can use it in our project where all all files and folder are available.
just above to yarn.log file
yarn.lock
, but that's not really your question, so I'd just take that part out and simplify the question, IMO.