devDependencies 필드에서 정의하는 모든 종속 항목은 무시되며 App Engine의 앱에 설치되지 않습니다.
최상의 성능을 위해서는 start 스크립트가 가벼워야 하고 빌드 단계를 제외해야 합니다. 애플리케이션의 새 인스턴스가 생성될 때마다 이 스크립트가 실행되기 때문입니다.
Artifact Registry를 사용하는 비공개 종속 항목
앱에서 비공개 npm 모듈이 사용되는 경우 Artifact Registry Node.js 패키지 저장소를 사용해서 비공개 종속 항목을 호스팅할 수 있습니다. 앱을 배포할 때 빌드 프로세스에서는 Cloud Build 서비스 계정에 대해 Artifact Registry 사용자 인증 정보가 자동으로 생성되므로, 추가 사용자 인증 정보를 생성할 필요가 없습니다.
비공개 종속 항목을 포함하려면 Artifact Registry 저장소를 나열하고 앱 디렉터리의 .npmrc 파일에서 레지스트리를 사용하여 인증 설정을 구성합니다. 예를 들면 다음과 같습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eNode.js application dependencies are managed in the \u003ccode\u003epackage.json\u003c/code\u003e file, where they are declared, and are automatically installed during deployment using \u003ccode\u003enpm install\u003c/code\u003e, \u003ccode\u003eyarn install --production\u003c/code\u003e, or \u003ccode\u003epnpm install\u003c/code\u003e, depending on the presence of a \u003ccode\u003eyarn.lock\u003c/code\u003e or \u003ccode\u003epnpm-lock.yaml\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine supports any Linux-compatible Node.js package and ignores dependencies specified under the \u003ccode\u003edevDependencies\u003c/code\u003e field in the \u003ccode\u003epackage.json\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003ePrivate 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 \u003ccode\u003e.npmrc\u003c/code\u003e or \u003ccode\u003e.yarnrc.yml\u003c/code\u003e files.\u003c/p\u003e\n"],["\u003cp\u003eTo enable an application to serve web requests, a web framework such as Express.js needs to be installed and included in the \u003ccode\u003epackage.json\u003c/code\u003e file.\u003c/p\u003e\n"],["\u003cp\u003eThe 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.\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\nDuring deployment, the Node.js runtime\n[automatically installs](/appengine/docs/standard/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: 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\n\nBy default, App Engine caches fetched dependencies to reduce build\ntimes. To install an uncached version of the dependency, use the command: \n\n gcloud app deploy --no-cache\n\n\u003cbr /\u003e\n\nSupport and limitations for the `package.json` file in the standard\nenvironment:\n\n- You can use any Linux-compatible Node.js package with\n App Engine, including packages that require native (C) extensions.\n\n- If the `engines` field is specified in your `package.json`, you must define a\n [compatible Node.js version](/appengine/docs/standard/nodejs/runtime#nodejs_version).\n\n- All dependencies that you define under the `devDependencies` field are\n ignored and do not get installed for your app in App Engine.\n\n- The `start` script should be lightweight and exclude build steps for the\n best performance because the script runs each time a new instance of your\n application is created.\n\n### Private dependencies with Artifact Registry\n\nIf your app uses a [private npm module](https://docs.npmjs.com/creating-and-publishing-private-packages),\nyou can use an [Artifact Registry Node.js package repository](/artifact-registry/docs/nodejs/store-nodejs)\nto host private dependencies. When deploying your app, the build process\nautomatically generates Artifact Registry credentials for the\n[Cloud Build service account](/build/docs/cloud-build-service-account)\nso you won't need to generate additional credentials.\nTo include private dependencies, list the Artifact Registry repository and\nconfigure settings for authenticating with the registry in your `.npmrc`\nfile in the app directory. For example: \n\n @\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eSCOPE\u003c/span\u003e\u003c/var\u003e:registry=https://\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e-npm.pkg.dev/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/\u003cvar translate=\"no\"\u003eREPOSITORY_NAME\u003c/var\u003e\n //\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e-npm.pkg.dev/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/\u003cvar translate=\"no\"\u003eREPOSITORY_NAME\u003c/var\u003e:always-auth=true\n\nNote that this approach also works for Yarn v1 package manager.\nIf you are using Yarn v2 or higher, list the Artifact Registry repository and\nconfigure settings for authenticating with the registry in your `.yarnrc.yml`\nfile in the app directory. For example: \n\n npmScopes:\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eSCOPE\u003c/span\u003e\u003c/var\u003e:\n npmRegistryServer: https://\u003cvar translate=\"no\"\u003eREGION_ID\u003c/var\u003e-npm.pkg.dev/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/\u003cvar translate=\"no\"\u003eREPOSITORY_NAME\u003c/var\u003e\n npmAlwaysAuth: true\n\nAfterwards, include your packages in the `package.json` file. For example: \n\n {\n \"dependencies\": {\n \" @\u003cvar translate=\"no\"\u003eSCOPE\u003c/var\u003e/my-package\": \"^1.0.0\"\n }\n }\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."]]