403 禁止 npm - cicd

403 Forbidden npm - cicd

我在工作中使用 git 管道并使用 Npm ci,当我 运行 管道时出现以下错误:

npm verb stack Error: 403 Forbidden - GET https://myUrl
npm verb stack     at /usr/lib/node_modules/npm/node_modules/npm-registry-fetch/check-response.js:117:15
npm verb stack     at runMicrotasks (<anonymous>)
npm verb stack     at processTicksAndRejections (internal/process/task_queues.js:95:5)
npm verb statusCode 403
npm verb pkgid @myComponent
npm verb cwd /builds/somewhere
npm verb Linux x.x.x-xxx-generic
npm verb argv "/usr/bin/node" "/usr/bin/npm" "ci" "--verbose"
npm verb node v14.18.0
npm verb npm  v6.14.15
npm ERR! code E403
npm ERR! 403 403 Forbidden - GET https://myUrl
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.

在我的 yml 文件中,我使用以下代码在我的脚本中进行身份验证:

    - npm config set @test:registry=https://myDir
    - npm config set -- //myUrl/api/somewhere/npm/:_authToken=${TOKEN}

我很确定我的令牌是正确的,因为当我在 powershell 中使用此命令并在浏览器中打开 myDir 时,我可以打开它。

我的文件夹中有一个 .npmrc,它使用的是过期的访问令牌,通过删除文件管道可以正常工作。