1

env file is in root directory. I run my server with npm run dev

.env

STRIPE_KEY=1234

When trying to use it in a js file const API_KEY = process.env.STRIPE_KEY

Im getting following error:

Cannot read properties of undefined (reading 'STRIPE_KEY')

Halaviw
  • 75
  • 6
  • Hi, did you tried that one? https://stackoverflow.com/a/67705541/8816585 – kissu Sep 06 '22 at 21:05
  • Does this answer your question? [How to use .env variables in Nuxt 2 or 3?](https://stackoverflow.com/questions/67703133/how-to-use-env-variables-in-nuxt-2-or-3) – some-user Sep 09 '22 at 12:04
  • @some-user pretty much what I posted above yeah. – kissu Sep 09 '22 at 12:12

0 Answers0