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

Accessing variable with $ does not work on windows with cross-env-shell

raDiesle opened this issue · comments

commented
  • cross-env version: 5.2.1
  • node version: 10.16.0
  • npm version: 6.9.0

On Windows 10, the example from documentation does not print variable by using $GREET, but %GREET% works:

{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1",
"parentScript": "cross-env GREET="Joe" npm run childScript",
"childScript": "cross-env-shell "echo Hello $GREET""
},
"author": "",
"license": "ISC",
"dependencies": {
"cross-env": "5.2.1"
}
}

By performing

npm run parentScript

In .npmrc PowerShell is configured

commented

I figured out by switching PowerShell back to default CMD, it works!

I guess documentation should be updated or to support PowerShell.

Sorry for not responding to this earlier. It's been long enough that I'm going to close this issue. If you're still experiencing problems, please open a new issue.