Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I add yarn-error.log to my .gitignore file?

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?

like image 726
danday74 Avatar asked Mar 04 '17 04:03

danday74


People also ask

Should you add yarn lock to Gitignore?

You should never, ever "gitignore" your lock files( package-lock. json and/or yarn. lock )! Even when installing using npm install , it generates a notice that we "should commit this file".

Where is yarn error log?

YARN client logs Errors that occur after the YARN client is started are logged in $APT_ORCHHOME/logs/yarn_logs/yarn_client.


1 Answers

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.

like image 163
Aurora0001 Avatar answered Oct 19 '22 09:10

Aurora0001