Github操作:无法安装私有GPR npm软件包

时间:2020-02-21 20:58:30

标签: node.js github npm github-actions

我在安装发布到GPR的范围内软件包时遇到了一些问题

有关我的操作文件,请参见下文

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

我的.npmrc文件如下:

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

我的私人访问令牌具有 read:packages write:packages repo 特权。

我在操作中遇到以下错误:

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

为了隐私起见,我已经为所有者回购版本名称加上了字幕。

0 个答案:

没有答案