Adding an environmental variable at the start of a package.json script prevents cd ./android from working – APP_ENV=production cd ./android

So I just noticed that if I have the following script in my package.json file:

"android:build:release": "APP_ENV=production cd ./android && ./gradlew clean bundleProductionRelease",

and I run it like this:

yarn android:build:release

It said "command not found: ./gradlew" because the cd to the android folder is not working, but as soon as I removed APP_ENV=production, it worked.

Any idea why is this happening?