Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shim.js issue on IOS #116

Open
rares-lupascu opened this issue Apr 23, 2022 · 2 comments
Open

shim.js issue on IOS #116

rares-lupascu opened this issue Apr 23, 2022 · 2 comments

Comments

@rares-lupascu
Copy link

i do not know if i am the only one having this issue but ...
this line in shim.js

process.env['NODE_ENV'] = isDev ? 'development' : 'production';

has to changed into this

env = process.env ?? {};
env['NODE_ENV'] = isDev ? 'development' : 'production';
process.env = env;

to fix this error on iOS

error shim.js: /Users/wowzaaa/Projects/ideomaker/radixstream/shim.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "StringLiteral".
TypeError: /Users/wowzaaa/Projects/ideomaker/radixstream/shim.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "StringLiteral"
    at Object.validate (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/types/lib/definitions/utils.js:131:11)
    at validateField (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/types/lib/validators/validate.js:24:9)
    at validate (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/types/lib/validators/validate.js:17:3)
    at NodePath._replaceWith (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/traverse/lib/path/replacement.js:170:5)
    at NodePath.replaceWith (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/traverse/lib/path/replacement.js:152:8)
    at PluginPass.MemberExpression (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/react-native-dotenv/index.js:122:16)
    at newFn (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/traverse/lib/visitors.js:177:21)
    at NodePath._call (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/traverse/lib/path/context.js:53:20)
    at NodePath.call (/Users/wowzaaa/Projects/ideomaker/radixstream/node_modules/@babel/traverse/lib/path/context.js:40:17)
info Run CLI with --verbose flag for more details.
Command PhaseScriptExecution failed with a nonzero exit code

if anyone has another fix for this i would love to hear about it :)

thanks

@DDushkin
Copy link

DDushkin commented Jun 22, 2022

I also had such error

Execution failed for task ':app:bundleReleaseJsAndAssets'.
Process 'command 'node'' finished with non-zero exit value 1

on creating android APK with./gradlew assembleRelease

Then I tried to run
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/

and it showed me more detailed error

error shim.js: /coinweb-app/shim.js: Property left of AssignmentExpression expected node to be of a type ["LVal"] but instead got "StringLiteral".

And in the end I was able to fix it like this

const isDev = typeof __DEV__ === "boolean" && __DEV__;
Object.assign(process.env, { NODE_ENV: isDev ? "development" : "production" });

So I agree there is a problem with

process.env['NODE_ENV'] = isDev ? 'development' : 'production';

@fifa-master
Copy link

@DDushkin Thank you man!!!
You saved my day

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

No branches or pull requests

3 participants