> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/autofix-to/connect-private-packages/npm-private-packages.md).

# NPM & PNPM - プライベートパッケージ

Aikido がプライベートパッケージを使用するリポジトリの依存関係を更新する際、lockfile を正しく更新するためにそれらのパッケージへのアクセスが必要です。Aikido を設定して、プライベート NPM レジストリで認証し、これらの更新を実行できます。

## 前提条件 <a href="#prerequisites" id="prerequisites"></a>

NPM または PNPM を使用するリポジトリでは、プライベートパッケージへのアクセスは、ある `.npmrc` ファイルによって管理されます。パッケージマネージャーは、 `.npmrc` どのレジストリを使うか、またどのように認証するかを知るために、そのファイルを使用します。

方法は 2 つあります:

* ある `.npmrc` ファイルをリポジトリに含め、ある [環境変数](https://help.aikido.dev/~/revisions/KY3QqEqZPV6ifxqjwoLa/aikido-autofix/connect-private-packages/custom-config-private-packages) をトークンに使用します。
* 設定を `.npmrc` Aikido のインターフェースで直接、 [こちら](#configuration-in-aikido).

プライベートパッケージ名が次のような形式の場合: `@pied-piper/***` で、GitHub の npm レジストリでホストされている場合、ファイルは次のようになります:

```
@pied-piper:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=<YOUR_GITHUB_TOKEN>
```

もし `.npmrc` ファイルが Aikido で設定されている場合、私たちは `.npmrc` 依存関係を更新する前にファイルを書き込みます。もし `.npmrc` ファイルがリポジトリ内に存在する場合、それは `.npmrc` Aikido で設定されたファイルによって上書きされます。

詳しい情報は `.npmrc` NPM から [こちら](https://docs.npmjs.com/cli/v8/configuring-npm/npmrc#auth-related-configuration).

## Aikido での設定 <a href="#configuration-in-aikido" id="configuration-in-aikido"></a>

プライベートパッケージを使用するリポジトリを更新できるようにするには、Aikido UI にプライベートレジストリ設定を提供してください。Aikido は認証情報を暗号化して保存し、認証情報は Aikido UI や API から取得できません。

1. 移動先 *自動修正* > *設定* Aikido で、 [こちら](https://app.aikido.dev/issues/fix/settings).
2. 「*レジストリを接続*」と、選択モーダルが表示されます。

<figure><img src="/files/93d539d9c2979772d40a2c418b778a2cd588532f" alt=""><figcaption></figcaption></figure>

3. NPM を選択して、あなたの `.npmrc` ファイル。

<figure><img src="/files/0215919553c63eba8514b4ea3239b2db5ba8ed49" alt=""><figcaption></figcaption></figure>

4. ファイルの内容を入力してください。 `.npmrc` ファイルの内容を入力してください。例は、スコープ付きパッケージ（`@pied-piper`）が GitHub Packages でホストされている設定を示しています。
5. クリック「*レジストリを接続*」をクリックして設定を保存します。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/autofix-to/connect-private-packages/npm-private-packages.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
