kentcdodds / cross-env

🔀 Cross platform setting of environment scripts
https://www.npmjs.com/package/cross-env
MIT License
6.32k stars 243 forks source link

Cross-env-shell in Windows via Npx doesn't handle multiple commands properly #245

Closed colin969 closed 3 years ago

colin969 commented 4 years ago

What you did: Trying to run cross-env-shell with multiple commands.

What happened: The second command doesn't get the environmental variables

Problem description: On Windows only and when called via npx, the second command doesn't get the environmental variables. No issue on Linux or Mac.

Used the example in the readme to keep it as simple as possible

Script - "greet": "cross-env-shell GREETING=Hi NAME=Joe \"echo $GREETING && echo $NAME\""
Output - Hi Joe

Script - "greet": "npx cross-env-shell GREETING=Hi NAME=Joe \"echo $GREETING && echo $NAME\""
Output - Hi $NAME

Suggested Solution: I'm not familiar enough to tell but I figure it's a breaking change to npx because it was working a few months ago.

Running without npx works fine in an npm script though, so I'm using that for now.

kentcdodds commented 3 years ago

https://github.com/kentcdodds/cross-env/issues/257