Date: 16/01/2026 17:05
Status : IMPLEMENTEE
Problème: Erreur 401 Unauthorized lors de l'installation des packages @nowhere/*
Cause: Token glpat-37Pn9EsCjzhmvbb5-Mw6 dans .npmrc expiré
Le projet utilise des packages npm privés hébergés sur GitLab :
@nowhere/qwikjs-lib (projet 10)@nowhere/ulias-lib (projet 13)Le .npmrc actuel contient un token d'accès personnel (PAT) qui a expiré.
Modifier .gitlab-ci.yml pour injecter dynamiquement le token dans chaque job :
# Ajouter dans le job test:
test:
stage: test
image: node:20-alpine
tags:
- docker
before_script:
# Configure npm pour utiliser le registry GitLab avec CI_JOB_TOKEN
- |
echo "@nowhere:registry=https://gitlab.33800.nowhere84.com/api/v4/projects/10/packages/npm/" >> .npmrc
echo "//gitlab.33800.nowhere84.com/api/v4/projects/10/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
echo "@nowhere:registry=https://gitlab.33800.nowhere84.com/api/v4/projects/13/packages/npm/" >> .npmrc
echo "//gitlab.33800.nowhere84.com/api/v4/projects/13/packages/npm/:_authToken=${CI_JOB_TOKEN}" >> .npmrc
script:
# ... reste du script
Avantages :
Créer un nouveau Personal Access Token avec scope read_api et mettre à jour .npmrc.
Inconvénients :
.gitlab-ci.yml pour configurer .npmrc avec CI_JOB_TOKEN dans le job testJe vais modifier directement les fichiers sur GitLab via l'API.
Attente validation avant exécution