Reputation: 3
I am trying to push npm artifact to azure devops artifact feed. Getting error (not able to get the error code as well- initially i was getting 500- internal server error) I have given all the required permission shown in the above diagram- Azure devops server - On-prem, 2020 version enter image description here
Tried below commands for testing a sample npm pacakge from same network level.
npm init
npm pack
npm install
npm publish
.npmrc configuration is below config
registry=https://azuredevops.abc.internal/kakanksha1/_packaging/kakanksha1/npm/registry/
always-auth=true
strict-ssl=false
; begin auth token
//azuredevops.abc.internal/kakanksha1/_packaging/kakanksha1/npm/registry/:username=kakanksha1
//azuredevops.abc.internal/kkakanksha1/_packaging/kakanksha1/npm/registry/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//azuredevops.abc.internal/kkakanksha1/_packaging/kakanksha1/npm/registry/:[email protected]
//azuredevops.abc.internal/kkakanksha1/_packaging/kakanksha1/npm/:username=kakanksha1
//azuredevops.abc.internal/kkakanksha1/_packaging/kakanksha1/npm/:_password=[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
//azuredevops.abc.internal/kakanksha1/_packaging/kakanksha1/npm/:[email protected]
; end auth token
https-proxy=https://proxy.abc.internal:8080
proxy=https://proxy.abc.internal:8080
Upvotes: 0
Views: 67
Reputation: 6037
Please verify your Azure DevOps collection name first. From the screenshot, we could see you might have the permissions to push to an Azure Artifacts feed in the collection of ramiMSFTDevOps
, while from the .npmrc
configuration file, you seemed to have been trying to publish packages into the collection of kakanksha1
or kkakanksha1
. The collection names from the registry URls were not the same.
Here is my .npmrc
file for your reference.
registry=http://aztfs/DefaultCollection/_packaging/CollectionScopeFeed/npm/registry/
always-auth=true
//aztfs/DefaultCollection/_packaging/CollectionScopeFeed/npm/registry/:username=DefaultCollection
//aztfs/DefaultCollection/_packaging/CollectionScopeFeed/npm/registry/:_password="[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]"
//aztfs/DefaultCollection/_packaging/CollectionScopeFeed/npm/registry/:[email protected]
//aztfs/DefaultCollection/_packaging/CollectionScopeFeed/npm/:username=DefaultCollection
//aztfs/DefaultCollection/_packaging/CollectionScopeFeed/npm/:_password="[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]"
//aztfs/DefaultCollection/_packaging/CollectionScopeFeed/npm/:[email protected]
To get the value of [BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
to be replaced in the .npmrc
file:
From a command/shell prompt run;
node -e "require('readline') .createInterface({input:process.stdin,output:process.stdout,historySize:0}) .question('PAT> ',p => { b64=Buffer.from(p.trim()).toString('base64');console.log(b64);process.exit(); })"
Paste your personal access token value when the command in step 1 asked for an input interactively and press Enter/Return;
Copy the Base64 encoded value and replace both [BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]
values in your .npmrc file like above with the encoded value.
Upvotes: 0