Skip to content

docs: deployment -> custom env variables, env-cmd example is not working  #6995

Closed
@VMois

Description

@VMois

Is this a bug report?

Incorrect information in docs -> Deployment.

Steps to Reproduce

  1. Go to https://facebook.github.io/create-react-app/docs/deployment#customizing-environment-variables-for-arbitrary-build-environments
  2. Follow the instruction and try to run env-cmd as suggested in docs. You will receive different error like FileNotFound etc. (I am using env-cmd version 9.0.1)

Expected Behavior

After some time, I found a solution. Working example:

"scripts": {
    "build:local": "env-cmd -f ./.env.production.local npm run build",
    "build:production": "env-cmd -f ./.env.production npm run build"
  }

Actual Behavior

In docs you can find something like this:

{
  "scripts": {
    "build:staging": "env-cmd .env.staging npm run build"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions