{"id":238093,"date":"2016-11-21T07:53:00","date_gmt":"2016-11-21T12:53:00","guid":{"rendered":"https:\/\/wordpress-756359-3782526.cloudwaysapps.com\/?p=238093"},"modified":"2025-05-30T07:47:21","modified_gmt":"2025-05-30T07:47:21","slug":"2016-11-21-travis-ci-now-supports-yarn","status":"publish","type":"post","link":"https:\/\/www.travis-ci.com\/blog\/2016-11-21-travis-ci-now-supports-yarn\/","title":{"rendered":"Travis CI now supports Yarn"},"content":{"rendered":"\n<p><a href=\"https:\/\/yarnpkg.com\/\">Yarn<\/a>&nbsp;is a new npm-compatible package manager for Node.js.<\/p>\n\n\n\n<p>Developed at Facebook in collaboration with Exponent, Google, and Tilde, Yarn is a great example of how the community came together to tackle the hard problem that is package management.<\/p>\n\n\n\n<p>Today, we are thrilled to announce that Yarn is now supported on Travis CI.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"256\" height=\"124\" src=\"https:\/\/www.travis-ci.com\/wp-content\/uploads\/2024\/07\/yarn.png\" alt=\"\" class=\"wp-image-240793\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-does-it-work\">How does it work?<\/h2>\n\n\n\n<p>If your Node.js project has the&nbsp;<code>yarn.lock<\/code>&nbsp;file in the repository root, we proceed to install Yarn and execute the&nbsp;<code>yarn<\/code>&nbsp;command instead of the default&nbsp;<code>npm install<\/code>.<\/p>\n\n\n\n<p>Please note that, at this time, Yarn is not yet pre-installed on our build images. This means that, if&nbsp;<code>yarn.lock<\/code>&nbsp;does not exist in the expected location, you are responsible for installing Yarn yourself. ( See&nbsp;<a href=\"https:\/\/github.com\/travis-ci\/travis-ci\/issues\/6720#issuecomment-254988120\">this GitHub issue comment<\/a>&nbsp;for a workaround.)<\/p>\n\n\n\n<p>We will make an announcement on our&nbsp;<a href=\"https:\/\/docs.travis-ci.com\/user\/build-environment-updates\/\">build environment updates page<\/a>&nbsp;(and the corresponding&nbsp;<a href=\"https:\/\/docs.travis-ci.com\/feed.build-env-updates.xml\">Atom feed<\/a>) when Yarn is pre-installed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"caching-with-yarn\">Caching with Yarn<\/h2>\n\n\n\n<p>We also added a handy directive to cache&nbsp;<code>$HOME\/.yarn-cache<\/code>&nbsp;for your convenience.<\/p>\n\n\n\n<p>To do this, just add:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cache: yarn<\/code><\/pre>\n\n\n\n<p>and equivalently, along with other caching directives:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cache:\n  yarn: true\n  directories:\n    - node_modules<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"further-information\">Further information<\/h2>\n\n\n\n<p>For more information, head on over to our&nbsp;<a href=\"https:\/\/docs.travis-ci.com\/user\/languages\/javascript-with-nodejs#Travis-CI-supports-yarn\">Node.js documentation<\/a>.<\/p>\n\n\n\n<p>As always, if you have questions or spot bugs, get in touch with us via&nbsp;<a href=\"https:\/\/github.com\/travis-ci\/travis-ci\/issues\">GitHub issues<\/a>&nbsp;or&nbsp;<a href=\"mailto:support@travis-ci.com\">email<\/a>.<\/p>\n\n\n\n<p>Happy testing!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yarn&nbsp;is a new npm-compatible package manager for Node.js. Developed at Facebook in collaboration with Exponent, Google, and Tilde, Yarn is a great example of how the community came together to tackle the hard problem that is package management. Today, we are thrilled to announce that Yarn is now supported on Travis CI. How does it [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_breakdance_hide_in_design_set":false,"_breakdance_tags":"","footnotes":""},"categories":[16],"tags":[24],"class_list":["post-238093","post","type-post","status-publish","format-standard","hentry","category-news","tag-nodejs"],"_links":{"self":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238093","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/comments?post=238093"}],"version-history":[{"count":1,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238093\/revisions"}],"predecessor-version":[{"id":240794,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/posts\/238093\/revisions\/240794"}],"wp:attachment":[{"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/media?parent=238093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/categories?post=238093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.travis-ci.com\/wp-json\/wp\/v2\/tags?post=238093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}