## TL;DR
After a refactor, the command file usually still exists but nothing imports it anymore. Point the supportFile config at the real file, import every moved command module from it, and restart Cypress. The runner bundles the support file once at startup, so edits need a restart to take effect.

## Error
```text
CypressError: cy.loginByApi() failed because the command does not exist.

The command is not registered. If it is a custom command, make sure it is
defined in a file loaded through the supportFile configuration.
```

## Steps
1. Open cypress.config.js and check e2e.supportFile points at the file that actually exists. Expected: the path resolves to a real file on disk.
2. Open that support file and confirm it imports every command module you moved:
```js
import './commands/login'
import './commands/api'
import './commands/navigation'
```
Expected: one import line per command module, with correct relative paths.
3. Check each moved module still calls Cypress.Commands.add with the same command name. Expected: names match what the specs call.
4. If supportFile is false or the path is stale, set it to the correct file. Expected: exactly one support file loads for the run.
5. Restart the Cypress runner completely, then re-run the spec. Expected: the custom command resolves.

## When to use
- cy.myCommand() throws command-not-found after moving or renaming files
- The refactor touched cypress/support or the commands folder
- The command works on the main branch but not on yours

## When not to use
- The command never existed (write and register it first)
- A plugin's commands are missing (check the plugin's setup instructions)
- TypeScript complains about the command type but the run works (a types problem, not a loading problem)

## Tool compatibility
- Cypress 10 through 14 with cypress.config.js supportFile
- Cypress 9 and earlier with cypress.json supportFile
- ES modules and CommonJS command files

## Variant phrasings
### Cypress custom command is not a function after moving files
Same cause. The spec loads but the command module never registered, so cy.myCommand is undefined.
### Support file refactor broke all custom commands
One bad import path in the support file can stop the whole file from loading. Check the runner console for the import error.

## Why it happens
Cypress loads a single support file at startup and registers whatever commands that file and its imports define. Refactors move the definitions into new files, and if the support file does not import them, or the configured path is stale, the commands silently never register.

## Edge cases
- Import path looks right but still fails: check for a typo in the folder name, including case. macOS forgives case, Linux and CI do not.
- Support file itself throws: nothing in it registers. Run the support file's imports by hand or check the Cypress console for the error.
- Monorepo with multiple Cypress configs: make sure you edited the supportFile of the config you actually run.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_8_mfvOyA-_V3YOn1ApuoNg
