Khant
Khant

Reputation: 1122

Why running this env-cmd command is giving me this error?

I am trying to configure the local environment inside my project.

i am running npm run dev command.

here is my package.json

enter image description here

As you can see i am using env-cmd package.

But when i run the command window is giving me this error.

This file does not have an app associated with it for performing this action...

enter image description here

Why am i getting this error?

Upvotes: 0

Views: 2140

Answers (1)

JRichardsz
JRichardsz

Reputation: 16505

According to this post:

https://medium.com/@rishi.vedpathak/react-environment-specific-builds-using-env-with-cra-and-env-cmd-5960a1253fe6

"scripts": {
    "start": "react-scripts start",
    "start:staging": "env-cmd -f .env.staging react-scripts start",
    "start:prod": "env-cmd -f .env.production react-scripts start",
    "build:staging": "env-cmd -f .env.staging react-scripts build",
    "build:prod": "env-cmd -f .env.production react-scripts build"
}

You are missing the -f parameter

Upvotes: 1

Related Questions