---
title: luna dev never runs in production
description: luna dev and luna deploy --watch refuse the production environment, because they redeploy on every save.
related:
  - /develop/develop-with-luna-dev
  - /develop/manage-environments
  - /develop/deploy-an-app
---

`luna dev` deploys your app again each time you save a file. That is safe in an environment of your own, and never in the one your app's users rely on.

## Issue

`luna dev` stops before it deploys, with this message.

```text
error: luna dev never runs in production. Run luna env use <name>, or luna env create <name> to make one.
```

`luna deploy --watch` stops with the same message.

## Cause

The environment chosen for the folder is `production`. It came from the `--env` flag, from `LUNA_ENV` in your shell, or from `LUNA_ENV=production` in the folder's `.env.local`.

`luna deploy --watch` also counts as production when no environment is chosen at all, since `luna deploy` goes to production by default.

## Solution

Work in an environment of your own. Make one, and the folder uses it from then on.

```bash
luna env create dev
```

To switch the folder to an environment that already exists, run `luna env use <NAME>`. Then run `luna dev` again.

Ship to production with a single deploy when the app is ready.

```bash
luna deploy --env production
```

[Deploy an app](/develop/deploy-an-app) covers what a deploy checks before it goes ahead.
