Invalid environment variable prefix

Why this error occurred

When declaring environment variables in your turbo.json, you cannot prefix them with $. This was an old syntax for declaring a dependency on an environment variable that was deprecated in Turborepo 1.5.

Turborepo logo
./turbo.json
{
  "globalEnv": ["$MY_ENV_VAR"]
}

The environment variable declared above has the $ prefix.

Solution

Remove the $ prefix from your environment variable declaration.

Turborepo logo
./turbo.json
{
  "globalEnv": ["MY_ENV_VAR"]
}

You can migrate to the env and globalEnv keys using npx @turbo/codemod migrate-env-var-dependencies. Check out the codemod's documentation for more details.