#Can't use .env.local to load NUXT_UI_PRO_LICENSE
3 messages · Page 1 of 1 (latest)
Based on the information provided in the knowledge sources, I can help you with this issue regarding the use of .env.local to load the NUXT_UI_PRO_LICENSE in Nuxt.
By default, Nuxt CLI has built-in support for reading the .env file in development, build, and generate modes. However, it doesn't automatically read .env.local. To use a different file like .env.local, you need to pass the --dotenv flag when using nuxi. Here's how you can do it:
npx nuxi dev --dotenv .env.local
This command tells Nuxt to use the .env.local file instead of the default .env file Docs > Guide > Directory-structure > .env (https://nuxt.com/docs/guide/directory-structure/env#custom-file).
Additionally, make sure that your .env.local file is formatted correctly with the NUXT_UI_PRO_LICENSE variable:
NUXT_UI_PRO_LICENSE=<your-license-key>
If you're still encountering issues, you can also try setting the license key directly in your nuxt.config.ts file:
export default defineNuxtConfig({
extends: ['@nuxt/ui-pro'],
uiPro: {
license: process.env.NUXT_UI_PRO_LICENSE
}
})
This approach allows Nuxt to read the environment variable during the build process Pro > Getting-started > Installation > Options (https://ui.nuxt.com/pro/getting-started/installation#options).
Remember that for production deployment, you'll need to set the NUXT_UI_PRO_LICENSE environment variable on your hosting platform, as the .env files are not used in production Pro > Getting-started > Installation (https://ui.nuxt.com/pro/getting-started/installation#license).