nodejs / readable-stream

Node-core streams for userland
https://nodejs.org/api/stream.html
Other
1.03k stars 227 forks source link

process.version.slice - undefined is not an object #313

Closed gwmccull closed 7 years ago

gwmccull commented 7 years ago

It appears that not all environments that are using this library pass a process.version.

Some of the libraries that I use in React Native are using this library at run-time and are not passing a version. Since version is undefined, the slice method fails.

calvinmetcalf commented 7 years ago

is process.verison missing or process itself ?

gwmccull commented 7 years ago

process and process.ENV are defined but not process.version

gwmccull commented 7 years ago

I found out that you can polyfill process.version by creating a globals file and specifying the missing process properties there. That's probably the best way to go rather than try to "fix" all of the Node libraries

Kishanjvaghela commented 6 years ago

@gwmccull How to create global file?

gwmccull commented 6 years ago

@kishanjvaghela I think I did something like this: https://stackoverflow.com/a/42149659

  1. Create global.js
  2. Add global.process.version to it as a JS variable
  3. Make sure global.js is imported as one of the first files in my project

I'm no longer on that project but those steps should get you close

Kishanjvaghela commented 6 years ago

Thanks a lot