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

null is not an object (evaluating 'process.version.match ...) #8

Closed
akiradeveloper opened this Issue Apr 21, 2018 · 5 comments

Comments

2 participants
@akiradeveloper

akiradeveloper commented Apr 21, 2018

I am trying to use PlayFab's Node SDK from react-native and this library would help. I am testing with Android now.

After installing, the missing url and https modules are found but still one issue remains please help me.

The line of code that makes the error is https://github.com/PlayFab/NodeSDK/blob/master/PlayFabSdk/Scripts/PlayFab/PlayFab.js#L40 and it seeems process (or process.version) is null.

Do you know some workaround?

@parshap

This comment has been minimized.

Owner

parshap commented Apr 22, 2018

Are you including node-libs-react-native/globals? See the "Globals" section of the readme. This will shim global.process using the process package which includes setting process.version to an empty string, which should resolve your issue.

@akiradeveloper

This comment has been minimized.

akiradeveloper commented Apr 23, 2018

@parshap Yes. Without the include, there is an another error "Can't find variable: Buffer".

@akiradeveloper

This comment has been minimized.

akiradeveloper commented Apr 23, 2018

btw, if the process.version is empty string the match will fail and lead to out-of-bound error.

I found the error comes from this because the error is gone with this code.

require('node-libs-react-native/globals');
global.process.version = "v8.8";

The empty value form the node-process library needs overwriting in this case.

@parshap

This comment has been minimized.

Owner

parshap commented Apr 24, 2018

What's the error you're getting exactly?

Sounds like this library isn't really compatible with React Native because it depends on checking process.version and this is not really available in React Native. If you want to shim your own fake version of node in there, I think that's fine, but you might get some other unexpected consequences.

@akiradeveloper

This comment has been minimized.

akiradeveloper commented Apr 24, 2018

My code somehow works now with the fake Node.js version. So I want to close this issue for now and will open other issues when it is needed. Thanks for helping me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment