Home > Software design >  403 Forbidden npm - cicd
403 Forbidden npm - cicd

Time:10-01

I use git pipeline and use Npm ci in my job, when I run pipeline I get the following error:

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.

In my yml file I use following code to authenticate in my script:

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

I'm pretty sure my Token is correct because when I use this command in powershell and open myDir in browser and I can open it.

CodePudding user response:

I had an .npmrc in my folder and that was using an expired Accesstoken, by removing file pipeline is working.

  • Related