This folder has no environment
luna dev stops because the folder's env file names no environment for it to deploy to.
luna dev deploys to an environment of your own, and it never makes one by itself. When the folder names none, it stops before it deploys anything.
Issue
luna dev prints this and exits.
error: This folder has no environment. Run luna env create dev.
When the folder names no project either, it stops one step earlier with this message.
error: This folder has no project. Run luna projects create <name>, or luna projects use <name> for one you have.
Cause
The CLI reads LUNA_PROJECT and LUNA_ENV from the app’s env file. It looks for .env.local, then .env, in the app’s folder and then in each folder above it, stopping at the repository’s root.
The variables come from three places, and the first one set wins:
- The
--projectand--envflags. LUNA_PROJECTandLUNA_ENVset in your shell.- The env file.
None of them named an environment. A fresh clone of the app has no .env.local unless someone committed it.
Solution
If the project is missing, choose it first with luna projects use <NAME>, or make one with luna projects create <NAME>.
Then make an environment of your own. luna env create also writes it to the folder’s .env.local.
luna env create dev
To use an environment that already exists, run luna env use <NAME> instead. Then run luna dev again.
Manage environments covers naming and per-developer environments.