Skip to content
This repository was archived by the owner on Aug 26, 2026. It is now read-only.
This repository was archived by the owner on Aug 26, 2026. It is now read-only.

401 Unauthorized when using a private package (on github registry) #366

Description

@hpandelo

I looked the docs and search a lot, but couldn't find any solution for this issue:

I'm running the build step creating the .npmrc file
Currently the Build Step works well. But the deploy fails with the error bellow:
Error: The deployment failed: HTTP status client error (401 Unauthorized) for url ([https://npm.pkg.github.com/@](https://npm.pkg.github.com/@<company>/<private-package-name>)

Note: I tried with permissions.package: read and permissions.package: write usong the ${{secrets.GITHUB_TOKEN}} but haven't worked since the package is outside the repo so I changed to use a PAT

Part of my github actions file:

jobs:
  deploy:
    name: Deploy
    environment: Production
    runs-on: ubuntu-latest

    permissions:
      packages: write # Needed to install private packages
      id-token: write # Needed for auth with Deno Deploy
      contents: read # Needed to clone the repository

     ....

      - name: Build step
        run: |
          cd backend/deno
          echo "@<company>:registry=https://npm.pkg.github.com/" > .npmrc
          echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_ACCESS_TOKEN }}" >> .npmrc
          echo "Caching the index.ts" && deno cache index.ts --allow-import
          echo "Running the build" && deno task build --environment production

      - name: Upload to Deno Deploy
        uses: denoland/deployctl@v1
        with:
          project: "<project name>"
          entrypoint: "index.ts" # 📝 Update the entrypoint
          root: "./backend/deno" # 📝 Update the root

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions