Search code examples
vuejs2vue-cli-3

How to fix missing .env variables in vue-cli 3


When I try to call .env variables from a local .env file using web-ci 3.7, they are undefined.

If I console.log process.env only

{
BASE_URL: "/",
NODE_ENV: "development"
}

are shown.

I set up an .env file in the project's root

This is how the env file looks like

VUE_APP_KEY: ******
VUE_APP_SECRET: *******
VUE_APP_TOKEN: *********
VUE_APP_BASE_URI=/api

Solution

  • Please try to use = instead of :

    VUE_APP_KEY= ******
    VUE_APP_SECRET= *******
    VUE_APP_TOKEN= *********
    VUE_APP_BASE_URI=/api