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
You can use Yarn to manage your Node.js dependencies on App Engine flexible environment. This tutorials provides a quick demonstration.
- Install Yarn.
- Manage Node.js dependencies with Yarn.
- 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
- Create a project in the Google Cloud Platform Console.
- Enable billing for your project.
- Install the Google Cloud SDK.
Install Yarn by following the installation instructions.
To install a package and automatically save it to your
yarn add PACKAGE
For example, to install and save the
yarn add google-cloud
Running this command will save the dependency into your
package.json, and create a
yarn.lockfile in the current directory. Don't delete this file! It will track the exact version of every package you need to run your application.
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.