ITADN

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

#366Openhpandelo 创建于 2025-03-12
H
hpandelocommented
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-name/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: ```yaml 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 "@syndi-co: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 ```
0 条评论