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

270
Vistas
process.env doesn't contain ENV VARS when `npm run build` (Ubuntu)

I'm deploying VueJS project. There is a file that contain API URLs where I use process.env. If API_URL is defined in production only so I can use localhost on my development server and API_URL in the production.

const apiRoot = process.env.API_URL || 'http://127.0.0.1:8000'

export default {
    root: apiRoot,
    auth: {
        jwt: {
            create: urljoin(apiRoot, "auth/jwt/login/"),
            refresh: urljoin(apiRoot, "auth/jwt/refresh/"),
        },
        loginPage: "/login",
        me: urljoin(apiRoot,"users/me/")
    }
}

On the server, I've added EXPORT API_URL='my.api.url' and then I ran npm run build. Then I realized it is still using 127.0.0.1:8000 so I also added the ENV VAR to /etc/environment file.

Again, no success. I've rebooted the server.

In cmd line I can do this:

echo $API_URL 
'my.api.url'

How to make it work? Or how to debug this issue?

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

0

The solution is simple. Each ENV VAR must start with VUE_APP_.

So instead of setting API_URL I need to set VUE_APP_API_URL

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