I'm currently having an issue with my CI Pipeline since it doesn't let me install my private npm dependency.
I'm currently able to push that image to the NPM Registry, but I can't use it in a different project. My pipeline look like this:
trigger:
batch: true
branches:
include:
- main
paths:
exclude:
- README.md
pool:
vmImage: "ubuntu-latest"
parameters:
- name: npm_token_private
displayName: Private Secret
type: string
default: my_secrets
values:
- my_secrets
- name: container_registry
displayName: ContainerRegistry
type: string
default: test01
values:
- test01
- test02
variables:
- group: ${{ parameters.npm_token_private }}
- name: repository
value: QA-Test
- name: containerRegistry
value: ${{parameters.container_registry}}
- name: Tags
value: master
stages:
- stage: Getting_Access_Repo
displayName: Preparing app for deployment
jobs:
- job:
continueOnError: false
steps:
# Gives access to repo
- checkout: self
clean: true
persistCredentials: true
- task: UseNode@1
inputs:
version: '14.x'
- script: npm set //registry.npmjs.org/:_authToken $(npm_token_private)
displayName: "Set Private Registry"
- script: npm i @test/logger
displayName: Installing logger
My issue is the following:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@test/logger - Not found
npm ERR! 404
npm ERR! 404 '@test/logger@^1.0.14' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vsts/.npm/_logs/2022-03-14T19_39_45_779Z-debug.log
##[error]Bash exited with code '1'.
What I don't understand is that I can push a new image to the NPM Registry by using the same npm_token_ptivate. Does someone knows if I have to recreate a new token or what else do I have to do?
CodePudding user response:
Try first this commands (in windows run as administrator)
npm config set registry http://registry.npmjs.org
if still not working let's update NPM and nodejs by running this commands
npm -g install npm
npm cache clean -f
npm install -g n
In addition, you can try to force updating and fixing the npm.
npm update --force
npm audit fix --force