Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

92
Vistas
path problems when deploying angular app in Gitlab pages

I am currently testing an angular app/java microservices backend, and I deployed the front on Gitlab Pages.

The gitlab-ci.yml is pretty simple so far, as I'm just testing the architecture :

cache:
  paths:
    - node_modules/

stages:
  - staging
  
pages:
  image: node:latest
  stage: staging
  script:
    - npm install -g @angular/cli@11.0.1
    - npm install
    - ng build --prod
  artifacts:
    paths:
    - public

I changed the angular.json to output public/ instead of dist/. The site deploys well on the adress https://myaccount.gitlab.io/repository-name but only the index.html works.

The reason being, all the href inside are somehow wrong :

<script src="runtime.0e49e2b53282f40c8925.js" defer></script>
<script src="polyfills.e6e62ba5ee83d54cee93.js" defer></script>
<script src="main.26f4db6ed1e6241cbf51.js" defer></script>

The href point to https://myaccount.gitlab.io/runtime.0e49e2b53282f40c8925.js instead of https://myaccount.gitlab.io/repository-name/runtime.0e49e2b53282f40c8925.js, so all my refs throw 404 errors

Does anyone know why it's that way, and how to fix it ? thanks a lot !

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Well sorry for the inconvenience, I found a very simple answer to my own problem, so I'll post it here in case someone needs it.

it's possible to simply change the base-href of an angular build with

--base-href /your-path/

So I just changed my ng build like this :

- ng build --prod --base-href /croquis-time-client/
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda