# Update a value in a project's .npmrc

`npm config` will prefer to use the user-local `.npmrc` (i.e. `~/.npmrc`). We can repurpose the `--userconfig` flag to write to an arbitrary file (e.g. an `.npmrc` stored in a project) instead:

```bash
npm config set key value --userconfig .npmrc
```

This can be useful in CI scenarios:

```yaml
- name: Configure NPM_TOKEN
  run: npm config set '//npm.pkg.github.com/:_authToken' "${NPM_TOKEN}" --userconfig .npmrc
  env:
    NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install dependencies
  run: npm ci
- name: Remove NPM_TOKEN config
  run: npm config delete '//npm.pkg.github.com/:_authToken' --userconfig .npmrc
```

Source: [stackoverflow](https://stackoverflow.com/questions/27788398/how-to-npm-config-save-into-project-npmrc-file)


---

# Agent Instructions: 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:

```
GET https://notes.eliasnorrby.com/npm/set-local-config.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
