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"
}
}
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: 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.
By default, App Engine caches fetched dependencies to reduce build times. To install an uncached version of the dependency, use the command:
gcloud app deploy --no-cache
Support and limitations for the package.json
file in the standard environment:
You can use any Linux-compatible Node.js package with App Engine, including packages that require native (C) extensions.
If the engines
field is specified in your package.json
, you must define a compatible Node.js version.
All dependencies that you define under the devDependencies
field are ignored and do not get installed for your app in App Engine.
The start
script should be lightweight and exclude build steps for the best performance because the script runs each time a new instance of your application is created.
If your app uses a private npm module, you can use an Artifact Registry Node.js package repository to host private dependencies. When deploying your app, the build process automatically generates Artifact Registry credentials for the Cloud Build service account so you won't need to generate additional credentials. To include private dependencies, list the Artifact Registry repository and configure settings for authenticating with the registry in your .npmrc
file in the app directory. For example:
@SCOPE:registry=https://REGION_ID-npm.pkg.dev/PROJECT_ID/REPOSITORY_NAME
//REGION_ID-npm.pkg.dev/PROJECT_ID/REPOSITORY_NAME:always-auth=true
Note that this approach also works for Yarn v1 package manager. If you are using Yarn v2 or higher, list the Artifact Registry repository and configure settings for authenticating with the registry in your .yarnrc.yml
file in the app directory. For example:
npmScopes:
SCOPE:
npmRegistryServer: https://REGION_ID-npm.pkg.dev/PROJECT_ID/REPOSITORY_NAME
npmAlwaysAuth: true
Afterwards, include your packages in the package.json
file. For example:
{
"dependencies": {
" @SCOPE/my-package": "^1.0.0"
}
}
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:
To use a particular web framework, such as Express.js, add the framework to your package.json
file:
For example, the resulting package.json
file might look as follows:
{
"dependencies": {
"lodash": "^4.0.1",
"express": "^4.16.2"
}
}
Installing the Cloud Client Libraries
The Cloud Client Libraries for Node.js is the idiomatic way for Node.js developers to integrate with Google Cloud services, such as Firestore in Datastore mode (Datastore) and Cloud Storage.
To install the Node.js client library for Cloud Storage:
Install the Cloud Client Libraries locally by using a package manager:
To use npm
, run:
npm install @google-cloud/storage
To use yarn
, run:
yarn add @google-cloud/storage
To use pnpm
, run:
pnpm add @google-cloud/storage
Set up authentication. You can configure the Cloud Client Libraries for Node.js to handle authentication automatically.
Use the Node.js client library for Cloud Storage reference to implement support for the Cloud Storage service in your app.
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 the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-07 UTC.
[[["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-07 UTC."],[[["Node.js application dependencies are managed in the `package.json` file, where they are declared, and are automatically installed during deployment using `npm install`, `yarn install --production`, or `pnpm install`, depending on the presence of a `yarn.lock` or `pnpm-lock.yaml` file."],["App Engine supports any Linux-compatible Node.js package and ignores dependencies specified under the `devDependencies` field in the `package.json`."],["Private npm modules can be hosted on Artifact Registry, with the build process automatically handling credentials for deployment, and the registry can be configured in the `.npmrc` or `.yarnrc.yml` files."],["To enable an application to serve web requests, a web framework such as Express.js needs to be installed and included in the `package.json` file."],["The Cloud Client Libraries for Node.js, such as the client library for Cloud Storage, can be installed via npm, yarn, or pnpm and provide a way to integrate with Google Cloud services, with authentication handled automatically."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4