Specifying dependencies

You specify the dependencies for your Node.js app by declaringthem in thepackage.json file.

For example, if you want to specifyLodash as a dependency, yourpackage.json file might look as follows:

{"dependencies":{"lodash":"^4.0.1"}}

You can use any Linux-compatible Node.js package with App Engine flexibleenvironment, including packages that require native (C) extensions.

During deployment, the Node.js runtimeautomatically installsalldependencies declared in yourpackage.json file. By default, thenpm install command is used, however Yarn and Pnpm package managers are alsosupported:

  • Yarn: If ayarn.lock file exists, theyarn install --productioncommand is used instead.

  • Pnpm: Supported only by Node.js runtimesversion 18 and version 20 (preview). If apnpm-lock.yaml fileexists, thepnpm install command is used instead.

Note that you must ensure that theyarn.lock orpnpm-lock.yaml file isnot specified in theskip_files section of yourapp.yaml file.

Installing a web framework

You'll need to use a web framework to enable your app to serve web requests. Youcan use any Node.js web framework including the following:

To use a particular web framework, such asExpress.js, add the framework to yourpackage.json file:

  • Usingnpm:

    npm install express
  • Usingyarn:

    yarn add express
  • Usingpnpm:

    pnpm add express

For example, the resultingpackage.json file might look as follows:

{"dependencies":{"lodash":"^4.0.1","express":"^4.16.2"}}

Installing the Cloud Client Libraries

TheCloud Client Libraries for Node.js is the idiomatic way for Node.js developers to integrate with Google Cloudservices, such asFirestore in Datastore mode (Datastore)andCloud Storage.

To install the Node.js client library for Cloud Storage:

  1. Install the Cloud Client Libraries locally by using a package manager:

    • To usenpm, run:

      npm install @google-cloud/storage
    • To useyarn, run:

      yarn add @google-cloud/storage
    • To usepnpm, run:

      pnpm add @google-cloud/storage
  2. Set up authentication. You can configure the Cloud Client Libraries for Node.jstohandle authentication automatically.

  3. Use theNode.js client library for Cloud Storagereference to implement support for the Cloud Storage service in yourapp.

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

Last updated 2026-02-19 UTC.