Stay organized with collections
Save and categorize content based on your preferences.
You specify the dependencies for your Node.js app by declaring
them in the package.json file.
For example, if you want to specify Lodash
as a dependency, your package.json file might look as follows:
{"dependencies":{"lodash":"^4.0.1"}}
You can use any Linux-compatible Node.js package with App Engine flexible
environment, including packages that require native (C) extensions.
During deployment, the Node.js runtime
automatically installs
all dependencies declared in your package.json file. By default, the
npm install command is used, however Yarn and Pnpm package managers are also
supported:
Yarn: If a yarn.lock file exists, the yarn install --production
command is used instead.
Pnpm: Supported only by Node.js runtimes
version 18 and version 20 (preview). If a pnpm-lock.yaml file
exists, the pnpm install command is used instead.
Note that you must ensure that the yarn.lock or pnpm-lock.yaml file is
not specified in the skip_files section of your app.yaml file.
Installing a web framework
You'll need to use a web framework to enable your app to serve web requests. You
can use any Node.js web framework including the following:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eDependencies for Node.js apps are specified in the \u003ccode\u003epackage.json\u003c/code\u003e file, and the Node.js runtime automatically installs them during deployment.\u003c/p\u003e\n"],["\u003cp\u003eWhile \u003ccode\u003enpm\u003c/code\u003e is used by default, Yarn and Pnpm are also supported, with Yarn using \u003ccode\u003eyarn install --production\u003c/code\u003e if a \u003ccode\u003eyarn.lock\u003c/code\u003e file is present and Pnpm using \u003ccode\u003epnpm install\u003c/code\u003e if a \u003ccode\u003epnpm-lock.yaml\u003c/code\u003e file is present (but only with specific versions of Node.js).\u003c/p\u003e\n"],["\u003cp\u003eAny Linux-compatible Node.js package can be used with the App Engine flexible environment, including those with native C extensions, and web frameworks like Express.js, Hapi.js, and others are supported and must be added to the \u003ccode\u003epackage.json\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThe Cloud Client Libraries for Node.js provide a way to integrate with Google Cloud services, and can be installed using \u003ccode\u003enpm\u003c/code\u003e, \u003ccode\u003eyarn\u003c/code\u003e, or \u003ccode\u003epnpm\u003c/code\u003e, with the library handling authentication.\u003c/p\u003e\n"]]],[],null,["# Specifying dependencies\n\nYou specify the dependencies for your Node.js app by declaring\nthem in the `package.json` file.\n\nFor example, if you want to specify [Lodash](https://lodash.com/)\nas a dependency, your `package.json` file might look as follows: \n\n {\n \"dependencies\": {\n \"lodash\": \"^4.0.1\"\n }\n }\n\nYou can use any Linux-compatible Node.js package with App Engine flexible\nenvironment, including packages that require native (C) extensions.\n\nDuring deployment, the Node.js runtime\n[automatically installs](/appengine/docs/flexible/nodejs/runtime#dependencies)\nall `dependencies` declared in your `package.json` file. By default, the\n`npm install` command is used, however Yarn and Pnpm package managers are also\nsupported:\n\n- Yarn: If a `yarn.lock` file exists, the `yarn install --production`\n command is used instead.\n\n- Pnpm: Supported only by Node.js runtimes\n version 18 and version 20 (preview). If a `pnpm-lock.yaml` file\n exists, the `pnpm install` command is used instead.\n\nNote that you must ensure that the `yarn.lock` or `pnpm-lock.yaml` file is\nnot specified in the `skip_files` section of your `app.yaml` file.\n\nInstalling a web framework\n--------------------------\n\nYou'll need to use a web framework to enable your app to serve web requests. You\ncan use any Node.js web framework including the following:\n\n- [Express.js](http://expressjs.com/)\n- [Hapi.js](http://hapijs.com/)\n- [Loopback.js](http://loopback.io/)\n- [Koa.js](http://koajs.com/)\n- [Kraken.js](http://krakenjs.com/)\n- [Restify.js](http://restify.com/)\n- [Sails.js](http://sailsjs.org/)\n\nTo use a particular web framework, such as [Express.js](https://expressjs.com/), add the framework to your `package.json` file:\n\n- Using [npm](https://www.npmjs.com/):\n\n ```\n npm install express\n ```\n- Using [yarn](https://yarnpkg.com/):\n\n ```\n yarn add express\n ```\n- Using [pnpm](https://pnpm.io/):\n\n ```\n pnpm add express\n ```\n\nFor example, the resulting `package.json` file might look as follows: \n\n {\n \"dependencies\": {\n \"lodash\": \"^4.0.1\",\n \"express\": \"^4.16.2\"\n }\n }\n\nInstalling the Cloud Client Libraries\n-------------------------------------\n\nThe [Cloud Client Libraries for Node.js](/nodejs/docs/reference)\nis the idiomatic way for Node.js developers to integrate with Google Cloud\nservices, such as [Firestore in Datastore mode (Datastore)](/datastore/docs/reference/libraries)\nand [Cloud Storage](/storage/docs/reference/libraries).\n\nTo install the Node.js client library for Cloud Storage:\n\n1. Install the Cloud Client Libraries locally by using a package manager:\n\n - To use `npm`, run:\n\n ```\n npm install @google-cloud/storage\n ```\n - To use `yarn`, run:\n\n ```\n yarn add @google-cloud/storage\n ```\n - To use `pnpm`, run:\n\n ```\n pnpm add @google-cloud/storage\n ```\n2. Set up authentication. You can configure the Cloud Client Libraries for Node.js\n to [handle authentication automatically](/docs/authentication/client-libraries).\n\n3. Use the [Node.js client library for Cloud Storage](/nodejs/docs/reference/storage/latest)\n reference to implement support for the Cloud Storage service in your\n app."]]