kentcdodds / cross-env

🔀 Cross platform setting of environment scripts

Home Page:https://www.npmjs.com/package/cross-env

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run cross-env from powershell in Windows?

GorvGoyl opened this issue · comments

  • cross-env version: 7.0.2
  • node version: 10
  • npm (or yarn) version: 6.13.4
  • powershell: 6.2.3
  • platform: windows
  • IDE: VSCode
    Relevant code or config

What you did:
I have installed cross-env in my project npm install --save-dev cross-env but how to set environment variable from powershell? when I execute cross-env NODE_ENV=dev in powershell it shows below error
What happened:

cross-env : The term 'cross-env' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ cross-env NODE_ENV=production
+ ~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (cross-env:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Reproduction repository:

Problem description:

Suggested solution:
It should set env variable similar to how package.json does when we use cross-env NODE_ENV=developement

I had to install it globally.