1

I've been having some issues installing a scoped package that that was published to GPR

See below for my actions file

name: run unit and coverage tests

on: [push]

jobs:
  build:

    runs-on: macos-latest

    strategy:
      matrix:
        node-version: [12.x]

    steps:
    - uses: actions/checkout@v1
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
        registry-url: 'https://npm.pkg.github.com/'
        scope: '@OWNER'
    - name: Authenticate with GitHub package registry
      run: echo "//npm.pkg.github.com:_authToken=${{ secrets.PRIVATE_ACCESS_TOKEN }}" > ~/.npmrc
    - name: npm install, build, and test
      run: |
        npm ci
        npm run test:unit
        npm run lint
        npm run test:e2e -- --headless
      env:
        CI: true

my .npmrc file is as follows:

@discoveryedu:registry=https://npm.pkg.github.com/

my private access token has read:packages, write:packages, and repo privileges.

I'm getting the following error in actions:

npm ERR! code E401
npm ERR! 401 Unauthorized - GET https://npm.pkg.github.com/download/@owner/repo/version/hash

i've subbed the owner, repo, and version names for privacy.

riQQ
  • 9,878
  • 7
  • 49
  • 66
  • same question as: https://stackoverflow.com/questions/64124831/github-actions-401-unauthorized-when-installing-a-github-package-with-npm-or-ya?noredirect=1 – MLyck Oct 07 '20 at 17:18
  • @StephenSylvester There is an answer to the question linked by MLyck, that should solve your problem as you also forgot the second backslash after the url: ` echo "//npm.pkg.github.com/:_authToken=..` instead of ` echo "//npm.pkg.github.com:_authToken=...`. – riQQ Oct 15 '20 at 08:15

0 Answers0