Skip to content
This repository has been archived by the owner on Jan 6, 2021. It is now read-only.

JSON parsing works on Win 10 but not on Mac #209

Closed
IainSAP opened this issue Sep 2, 2019 · 1 comment
Closed

JSON parsing works on Win 10 but not on Mac #209

IainSAP opened this issue Sep 2, 2019 · 1 comment

Comments

@IainSAP
Copy link

IainSAP commented Sep 2, 2019

  • cross-env version: 5.2.0
  • node version: v10.16.0
  • npm (or yarn) version: 6.9.0

Relevant code or config

package.json

...
"scripts": {
        "start-app": "cross-env destinations=[{\\\"name\\\":\\\"odata\\\",\\\"url\\\":\\\"abc\\\"}] node node_modules/abc/app/app1.js",..

Problem:
npm run start-app runs correctly on Windows. JSON is parsed as expected and env env var is set as destinations="[{"name":"odata","url":"abc"}]"

What happened:

On Mac the same JSON is parsed as "["url":"abc"]", note the missing '{}' and first property. I have also tried wrapping the json with '' which results in invalid json (note the still present ''):
"[{\"name\":\"odata\",\"url\":\"abc\"}]"

Expected:

The destinations env var is correctly set as JSON string on both Win and Mac.

@kentcdodds
Copy link
Owner

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 with a reproduction repository. Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants