Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

** edit - important detail: verdaccio is also running in a docker container. Issue seems to be container to container communication. I have the npm registry set to localhost but I think it's trying to connect to localhost in the container's context and not the container host.

I'm trying to install a package from a Verdaccio registry running on localhost and not sure how to change either the skaffold configuration or the dockerfile to change the registry from npmjs to Verdaccio. The 404 error I'm receiving is below:

npm notice npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/@flashsparkmedia%2fcommon - Not found npm ERR! 404 npm ERR! 404 '@flashsparkmedia/common@^1.0.3' 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.

Here is my dockerfile and skaffold.yaml for reference:

apiVersion: skaffold/v2beta4
kind: Config
deploy:
    kubectl:
        manifests:
            - ./infra/k8s/*
build:
    local:
        push: false
    artifacts:
        - image: flashsparkmedia/auth
          context: auth
          docker:
              dockerfile: Dockerfile
              network: host
          sync:
              manual:
                  - src: 'src/**/*.ts'
                    dest: .
        - image: flashsparkmedia/client
          context: client
          docker:
              dockerfile: Dockerfile
          sync:
              manual:
                  - src: '**/*.js'
                    dest: .

FROM node:alpine

WORKDIR /app
ARG NPM_TOKEN
COPY .npmrc .
COPY package.json .
RUN npm install --only-prod 
RUN rm -f .npmrc

COPY . .
CMD npm start

I also have a .npmrc file in root directory referencing localhost:4873 with an _authToken variable

question from:https://stackoverflow.com/questions/65645708/using-verdaccio-registry-with-skaffold

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
605 views
Welcome To Ask or Share your Answers For Others

1 Answer

Solved. Added the 'network' field under 'docker' to my image in the artifacts array and ensure the .npmrc file was copied over correctly into the root directory. The example in the question has been edited with the correction.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...