Edit on GitHub
Report issue
Page history

Using Yarn on App Engine

Author(s): @justinbeckwith ,   Published: 2017-03-16

Justin Beckwith | Developer Programs Engineer | Google

Contributed by Google employees.

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. Use Yarn to install dependencies during deployment to App Engine.


This tutorial uses billable components of Google Cloud, including:

  • 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 Cloud Console.
  2. Enable billing for your project.
  3. Install the 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!

Submit a tutorial

Share step-by-step guides

Submit a tutorial

Request a tutorial

Ask for community help

Submit a request

View tutorials

Search Google Cloud tutorials

View tutorials

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.