---
title: "[Contentstack Command-line Interface (CLI)] - Change Master Locale"
description: Change the master locale of data exported from the Contentstack CLI to match the destination stack master locale.
url: https://www.contentstack.com/docs/developers/cli/change-master-locale
product: Contentstack
doc_type: cli-guide
audience:
  - developers
version: CLI v1.1.0+
last_updated: 2026-03-26
---

# [Contentstack Command-line Interface (CLI)] - Change Master Locale

This page explains how to use the Contentstack CLI `change-master-locale` utility to update the master locale in exported data so it matches the destination stack. It is intended for developers migrating or importing content between stacks with different master locales, and should be used when an import fails due to a master locale mismatch.

## Change Master Locale

While importing data using the Contentstack’s CLI, if the destination stack has a different master locale than the source stack, the API throws an error indicating that the master locale of the incoming data does not exist in the destination stack.

As a solution, you can change the master locale of the data exported from the CLI using the `change-master-locale` utility so that it matches the master locale of the destination stack.

## Prerequisites
- [Contentstack account](https://www.contentstack.com/login)
- [CLI installed](https://www.contentstack.com/docs/developers/cli/install-the-cli/) (version 1.1.0 and above)

## Steps for Execution
- [Export the data](/docs/developers/cli/export-content-using-the-cli) from the source stack using the `cm:stacks:export` command.
- Download the [examples](https://github.com/contentstack/cli/tree/main/packages/contentstack-migration/examples) folder and navigate to the folder using the `cd` command in the terminal.
```
cd
```
- Find the `change-master-locale` script in the `examples` folder. Execute the script using the migration command as follows:
```
csdx cm:stacks:migration --file-path ./change-master-locale/02-change-master-locale-new-file-structure.js --config target_locale: data_dir:
```
**Note:** `path-to-the-exported-data` can either be the relative path or the absolute path.

Alternatively, You can save the config parameters to a `config.json` file and use it as follows:

```
csdx cm:stacks:migration --file-path ./change-master-locale/02-change-master-locale-new-file-structure.js --config-file
```
**Note: **If you used the CLI version below `1.9.0` to [export the data](/docs/developers/cli/export-content-using-the-cli), use the `01-change-master-locale.js` script instead of `02-change-master-locale-new-file-structure.js` in the examples above.
- [Import the data](/docs/developers/cli/import-content-using-the-cli) to the target stack using the `cm:stacks:import` command.

## Troubleshoot
If you are facing a **Migration Unsuccessful** or **Module cannot be found** error, please try one of the following troubleshooting methods:
- **Troubleshoot in your current terminal session**:**Windows (CMD)**:
```
FOR /F "usebackq tokens=*" %i IN (`npm root -g @contentstack/cli`) DO SET NODE_PATH=%i/@contentstack/cli/node_modules
```
- **Windows (PowerShell)**:
```
foreach ($i in $(npm root -g @contentstack/cli)) { $env:NODE_PATH = "$i/@contentstack/cli/node_modules" }
```
- **Mac/Unix**:
```
export NODE_PATH="$(npm root -g @contentstack/cli)/@contentstack/cli/node_modules"
```

## Limitations
- This utility does not work for the clone command.

## Common questions

### When should I use `change-master-locale`?
Use it when importing exported data into a destination stack that has a different master locale than the source stack and the import fails due to a master locale mismatch.

### Which script should I use: `01-change-master-locale.js` or `02-change-master-locale-new-file-structure.js`?
If you used the CLI version below `1.9.0` to export the data, use `01-change-master-locale.js`; otherwise use `02-change-master-locale-new-file-structure.js`.

### What does `path-to-the-exported-data` refer to?
It refers to the location of the exported data directory, and it can be either a relative path or an absolute path.

### What can I do if I get “Migration Unsuccessful” or “Module cannot be found”?
Try setting `NODE_PATH` for your environment using the provided Windows (CMD), Windows (PowerShell), or Mac/Unix troubleshooting commands.