Open utterances-bot opened 1 year ago
Your article was really helpful just need one more help I am using Nuxt3 and want to create multiple environment file I install dotenv package and created .env.development and set
//nuxt.config.ts
import dotenv from 'dotenv'
dotenv.config({ path: .env.${process.env.NODE_ENV}
})
but now it says ERROR Cannot start nuxt: Unable to obtain an available random port number! can you help
I tried setting environment file from package.json nothing work nor found any article on it. .env files are in gitignore file that is we didn't add it in repo
Hey @prashantnirgun, you'll probably want to use Nuxt's runtimeConfig.
Check out https://nuxtjs.org/tutorials/moving-from-nuxtjs-dotenv-to-runtime-config/.
Thanks for your reply I already go through this article. It shows you to create env variables or default value to variables. My Issue is I possibly have 3 values for development, staging and production. I can't even hard code that value in nuxt.config.ts. That is missing I tried dotenv @nuxt/dotenv they are for the same purpose but unfortunately they are not compatible for nuxt3 latest release.
Cody Bontecou | Cody Bontecou
A VitePress site
https://codybontecou.com/contact.html