I setup Gitlab and Gitlab runner on k8s. Gitlab runner is connected to Gitlab instance and run commands correctly. After run job to publish my Vuejs project i got network error from gitlab runner in npm install command line.
This is my gitlab-ci.yaml:
build site:
image: node:lts-alpine
stage: build
script:
- npm install --progress=false
- npm run build
artifacts:
expire_in: 1 week
paths:
- dist
This is my Gitlab runner logs:
Running with gitlab-runner 16.6.1 (f5da3c5a)
on lms-git-runner-01 esosuhkgL, system ID: r_SjhlYAhCSRTB
Preparing the "kubernetes" executor
00:00
Using Kubernetes namespace: gitlab-runner
Using Kubernetes executor with image node:lts-alpine ...
Using attach strategy to execute scripts...
Preparing environment
00:06
Using FF_USE_POD_ACTIVE_DEADLINE_SECONDS, the Pod activeDeadlineSeconds will be set to the job timeout: 1h0m0s...
Waiting for pod gitlab-runner/runner-esosuhkgl-project-1-concurrent-0-bgff4642 to be running, status is Pending
Waiting for pod gitlab-runner/runner-esosuhkgl-project-1-concurrent-0-bgff4642 to be running, status is Pending
ContainersNotReady: "containers with unready status: [build helper]"
ContainersNotReady: "containers with unready status: [build helper]"
Running on runner-esosuhkgl-project-1-concurrent-0-bgff4642 via gitlab-runner-8b59c79dc-zmrfb...
Getting source from Git repository
00:03
Fetching changes with git depth set to 20...
Initialized empty Git repository in /builds/frontend/lms-frontend-v3/.git/
Created fresh repository.
Checking out e6aa6709 as detached HEAD (ref is main)...
Skipping Git submodules setup
Executing "step_script" stage of the job script
$ npm install --progress=false
npm ERR! code ECONNRESET
npm ERR! network aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2023-12-26T09_21_54_880Z-debug-0.log
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: command terminated with exit code 1
Need to run correctly ci/cd without problem.
My error was due to the fact that when npm is receiving packages and it fails to receive one of the packages, it does not try again, following these steps solved my problem
First i used npm install with --verbose attribute to show all installing logs:
npm install --verbose
Then use the --force option to retry npm when you catch any error and continue to install all npm packages:
npm install --verbose --force