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

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

colin969 opened this issue · comments

commented
  • cross-env version: 7.0.2
  • node version: 12.16.3
  • npm version: 6.14.4

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.