Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Especifique as dependências do aplicativo Node.js declarando-as
no arquivo package.json.
Por exemplo, se você quiser especificar Lodash
como uma dependência, seu arquivo package.json pode ser semelhante a:
{"dependencies":{"lodash":"^4.0.1"}}
É possível usar qualquer pacote do Node.js compatível com o Linux com o ambiente flexível do App Engine, inclusive pacotes que exigem extensões nativas (C).
Durante a implantação, todas as dependencies declaradas no arquivo package.json são instaladas automaticamente pelo ambiente de execução do Node.js. Por padrão, o
comando npm install é usado, mas os gerenciadores de pacotes Yarn e Pnpm também são
compatíveis:
Yarn: se existir um arquivo yarn.lock, o comando yarn install --production será usado.
Pnpm: compatível apenas com os ambientes de execução do Node.js versão 18 e versão 20 (visualização). Se um arquivo pnpm-lock.yaml existir, o comando pnpm install será usado.
É preciso garantir que o arquivo yarn.lock ou pnpm-lock.yaml não esteja especificado na seção skip_files do arquivo app.yaml.
Como instalar um framework da Web
Você precisará usar uma biblioteca da Web para permitir que o aplicativo disponibilize solicitações da Web. Você pode usar qualquer biblioteca da Web do Node.js, incluindo estas:
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-03 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."]]