1

I'm using @vue/cli 4.2.3 but when I create a .env file in my project root folder and declared a new env variable in it then print it in any component it returns undefined. My env variable is like VUE_APP_NAME=VALUE and I'm calling it like console.log(process.env.VUE_APP_NAME) and the result is always undefined Any help, pls?

1

1 Answer 1

1

With the information you give it seems that you are doing well.

  1. The file is in the root.
  2. The variable starts by VUE_APP_

I would check that the .env file has no extension.

3
  • It's a normal .env file is there anything more I can do? Jun 16, 2020 at 21:51
  • Supposedly not, but if you have disabled the file extension view you may have created a .txt. It is a supposition, I already tell you, by the data you put you are doing well
    – Vallemar
    Jun 16, 2020 at 21:56
  • Thanks for your time I'll keep searching. Jun 16, 2020 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.