# Troubleshooting

Each section below starts from the error you see during an install, then gives the fix.

## 401 Unauthorized during install

The token is missing, expired or revoked. Check it with npm.

```sh
npm whoami --registry=https://plus.adonisjs.com/registry/
```

If it prints `ENEEDAUTH`, npm has no token for the registry: sign in again with `npm login --registry=https://plus.adonisjs.com/registry/ --scope=@adonisplus --auth-type=web`. If it prints `401 Unauthorized`, the token was revoked or expired: sign in again, or create a new token in [Tokens](/account/tokens).

## 401 with pnpm 11

Your `.npmrc` has a line like `//plus.adonisjs.com/registry/:_authToken=${ADONISJS_PLUS_TOKEN}`. Since 11.5.3, pnpm no longer fills in variables in a project's `.npmrc`, so it sends no token. Remove the line, keep only the scope line, and pass the token as [CI and deployment](/docs/get-started/ci-and-deployment) shows.

## 404 Not Found from registry.npmjs.org

The scope line is missing, so your package manager looks for `@adonisplus` packages on the public registry. Add it to the `.npmrc` at the root of your project.

```ini [.npmrc]
@adonisplus:registry=https://plus.adonisjs.com/registry/
```

With Yarn, it goes in `.yarnrc.yml`. See the next section.

## Yarn

Yarn does not read `.npmrc`. The scope goes in the project's `.yarnrc.yml`, and `yarn npm login --scope adonisplus --web-login` saves the token in your home `.yarnrc.yml`.

```yaml [.yarnrc.yml]
nodeLinker: node-modules
npmScopes:
  adonisplus:
    npmRegistryServer: "https://plus.adonisjs.com/registry"
```

Flow does not support Plug'n'Play yet, so `nodeLinker` must be `node-modules`.

## The registry URL in the error ends with `//plus.adonisjs.com/registry/:_authToken=…`

Your `.npmrc` does not end with a newline, and the command that added the token glued it to the scope line. npm then read the whole line as the registry URL, and printed it, with your token, in the log.

Revoke that token in [Tokens](/account/tokens) and create a new one. Then add the token with `printf`, which starts a new line, as [CI and deployment](/docs/get-started/ci-and-deployment) shows.

## Works locally but fails in CI

On your computer, the token comes from your own npm config. CI runners do not have it. Add `ADONISJS_PLUS_TOKEN` to your CI and pass it to the install, as [CI and deployment](/docs/get-started/ci-and-deployment) shows.

## Works in CI but fails in Docker

A Docker build does not see your CI secrets or your environment. Pass the token with `--secret` when you build, or `--build-secret` on Fly.io, and read it with `--mount=type=secret,id=ADONISJS_PLUS_TOKEN` in the `RUN` that installs. See [Docker builds](/docs/get-started/ci-and-deployment#docker-builds).
