Search code examples
node.jsnpmgitlabgitlab-cigitlab-ci-runner

why gitlab runner don't use my custom npm registry but use the default npm registry


I installed a gitlab runner on my window machine

and I run terminal input "npm config set registry http://my/custom/npm/registry"

enter image description here

and then i trigger a pipeline on my gitlab web page

enter image description here i saw the terminal pannel show me a default registry value after run "npm config get registry"

why ??

did the gitlab runner doesn't use my npm config on the local machine ?

also, i use nrm to switch the npm registry, i got the same result


Solution

  • Try moving your npm config set registry https://custom-registry.example.com inside your job specification instead of on your host. So for example:

    npm_dependencies:
      stage: npm
      before_script:
        - npm config set registry https://custom-registry.example.com
      script:
        - npm config get registry
        - npm install