I get the below error when using runner for the below pipeline. Is it because I am not using a custom docker image to run node?
Hi Ajay,
Thank you for contacting Atlassian Community! I'm Norbert from Bitbucket Cloud Support, it's nice to meet you!
Based on my observation your build fails as the NPM is not able to authenticate with the remote repository.
Based on the following link, removing the ".npmrc" resolves this issue: https://stackoverflow.com/questions/48823562/npm-install-resulting-in-401-unauthorized-for-private-repo
Can I ask you to try to remove this file and let us know if it resolves the issue?
I'm looking forward to hear from you, Ajay.
Best Regards,
Norbert
Atlassian Bitbucket Cloud Support
Hi @Norbert C
Thanks for the reply.
As it tuned out I was using private modules in my package.json and therefore the 401. I followed the documentation mentioned here to configure the .npmrc file and it works fine.
If you are using private modules from either the public npm registry or your own private registry you can simply check in a .npmrc file at the root of your repository using repository variables. To avoid conflict with the local ~/.npmrc file during development you can simply name it .npmrc_config and rename it as part of the pipeline script.
.npmrc_config
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
registry=https://registry.npmjs.org
& in the Pipeline
pipelines:
default:
- step:
script:
- mv .npmrc_config .npmrc
- npm install
Cheers
Ajay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ajay,
Thank you for your reply. We appreciate your detailed explanation and we're glad to hear that it works :).
Have a great week ahead!
Best Regards,
Norbert
Atlassian Bitbucket Cloud Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.