0

npm ci在 GitHub 工作流操作中的节点 16 上运行并不断收到以下错误:

npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR!     https://www.npmjs.com/forgot
npm ERR! 
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR!     npm login

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2022-01-10T11_38_28_617Z-debug.log
Error: Process completed with exit code 1.

我尝试删除 package-lock.json 文件并在npm i本地运行并上传新文件。但这并没有什么不同。

工作流文件

name: Node.js CI

on:
  push:
    branches: [ "*" ]
  pull_request:
    branches: [ "*" ]

jobs:
  test:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - name: Build the Docker image and run tests
      uses: actions/checkout@v2
    - run: npm ci
    - run: npm test

请告知我如何解决这个问题。

4

1 回答 1

0

看起来您package-lock.json文件中的某些包位于私有注册表中。

您需要按照错误中的说明登录该注册表。否则 NPM 无法拉取这些包。

于 2022-01-10T11:49:29.307 回答