Edit on GitHub
Report issue
Page history

Author(s): @{[ username ]}  Published: {[ TutorialCtrl.tutorial.date_published | date:'mediumDate' ]}

title: Using Yarn on Google App Engine description: Learn how to use Yarn to manage dependencies for Node.js applications on Google App Engine flexible environment. author: justinbeckwith tags: App Engine, Yarn, Node.js, npm date_published: 2017-03-16

Yarn is a package management tool that makes it easy and fast to install npm modules for Node.js.

You can use Yarn to manage your Node.js dependencies on App Engine flexible environment. This tutorials provides a quick demonstration.


  1. Install Yarn.
  2. Manage Node.js dependencies with Yarn.
  3. Using Yarn to install dependencies during deployment to App Engine.


This tutorial uses billable components of Google Cloud Platform, including:

  • Google App Engine flexible environment

Use the Pricing Calculator to generate a cost estimate based on your projected usage.

Before you begin

  1. Create a project in the Google Cloud Platform Console.
  2. Enable billing for your project.
  3. Install the Google Cloud SDK.

Getting started

  1. Install Yarn by following the installation instructions.

  2. To install a package and automatically save it to your package.json run:

    yarn add PACKAGE

    For example, to install and save the google-cloud package:

    yarn add google-cloud

    Running this command will save the dependency into your package.json, and create a yarn.lock file in the current directory. Don't delete this file! It will track the exact version of every package you need to run your application.

yarn add google-cloud

Deploying to App Engine

To use Yarn for your deployments to App Engine flexible environment, all you need is a yarn.lock in your application directory. Then, just deploy:

gcloud app deploy

If App Engine finds a yarn.lock in the application directory, Yarn will be used to perform the npm installation. Learn more about the Node.js runtime for App Engine flexible environment.

gcloud app deploy

And that's it! If you have any other questions about Node.js on Google Cloud Platform, be sure to join us on our Slack channel.

See more by @{[ username ]} and more tagged {[ tag ]}{[ $last ? '' : ', ' ]}

Submit a Tutorial

Share step-by-step guides


Request a Tutorial

Ask for community help


GCP Tutorials

Tutorials published by GCP


Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see our Site Policies. Java is a registered trademark of Oracle and/or its affiliates.