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

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

Closed raDiesle closed 5 years ago

raDiesle commented 5 years ago

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

raDiesle commented 5 years ago

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

I guess documentation should be updated or to support PowerShell.

kentcdodds commented 5 years ago

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.