MagicMirrorOrg/MagicMirror · warning

config.js.template files are deprecated and not used anymore

Error message

config.js.template files are deprecated and not used anymore. You can use variables inside config.js so copy the template file content into config.js if needed.

What it means

loadConfig checks whether a config.js.template file exists next to config.js. MagicMirror no longer processes template files; if one is found, it warns that templates are dead and that environment-variable substitution should be done directly inside config.js (config.js is executed as JS, so variables work natively).

Source

Thrown at js/utils.js:118

 * @returns {object} an object holding full and redacted config
 */
const loadConfig = () => {
	Log.log("Loading config ...");
	const defaults = require("./defaults");
	if (global.mmTestMode) {
		// if we are running in test mode
		defaults.address = "0.0.0.0";
	}

	// For this check proposed to TestSuite
	// https://forum.magicmirror.builders/topic/1456/test-suite-for-magicmirror/8
	const configFilename = getConfigFilePath();
	let templateFile = `${configFilename}.template`;

	// check if templateFile exists
	try {
		fs.accessSync(templateFile, fs.constants.F_OK);
		Log.warn("config.js.template files are deprecated and not used anymore. You can use variables inside config.js so copy the template file content into config.js if needed.");
	} catch {
		// no action
	}

	// check if config.env exists
	const configEnvFile = `${configFilename.substr(0, configFilename.lastIndexOf("."))}.env`;
	try {
		if (fs.existsSync(configEnvFile)) {
			// load content into process.env
			loadEnvFile(configEnvFile);
		}
	} catch (error) {
		Log.log(`${configEnvFile} does not exist. ${error.message}`);
	}

	// Load config.js and catch errors if not accessible
	try {
		let configContent = fs.readFileSync(configFilename, "utf-8");

View on GitHub (pinned to 4b4a59534f)

Solutions

  1. Delete or rename the config.js.template file.
  2. If you need env-var substitution, put it directly in config.js, e.g. use process.env.MY_VAR inside the config JavaScript.
  3. Use the supported config.env file (loaded alongside config.js) if environment-based configuration is desired.

Example fix

// before: config.js.template contains ${MM_PORT}
// after: delete config.js.template and in config.js write
var config = { port: process.env.MM_PORT || 8080 };
Defensive patterns

Strategy: validation

Validate before calling

# ensure no template file lingers before starting:
ls config/config.js* # remove config.js.template if present
rm -f config/config.js.template

Prevention

When it happens

Trigger: A leftover config.js.template file sits in the config directory (often from old Docker setups that previously consumed it) while checkConfigFile/loadConfig runs at startup.

Common situations: Migrating from an old docker container or install scripts that generated config.js.template; following an outdated tutorial that instructs creating a .template file.

Related errors


AI-assisted analysis of MagicMirrorOrg/MagicMirror@4b4a59534f (2026-08-31). Data as JSON: /api/errors/d792066c1b6a1bf0. Report an issue: GitHub.