I am trying to get a web-project to run cross-platform, however I ran into the following problem. I don't think the project details matter, so I will just post the problematic lines from the package.json here:
"dev-local": "cross-env PREFIX=$(whoami) yarn dev"
The problem arises when used on Windows. The execution fails with
yarn was unexpected at this time.
If I use hardcoded values it works fine, but that is of course not a viable solution
"dev-local": "cross-env PREFIX=hello yarn dev"
So it looks like the problem is the command substitution - however I don't understand why. I am using windows powershell.
I did not find an answer, but this can be used as a workaround if anyone runs into a similar problem:
"dev-local": "cross-env PREFIX=$(whoami) yarn dev",
"dev-local-windows": "set PREFIX=%USERNAME%& yarn dev",