eugenehp / react-native-uuid

UUID generation for react-native.
MIT License
256 stars 36 forks source link

Doesn't work? #8

Closed hexxone closed 3 years ago

hexxone commented 7 years ago

error: bundling failed: "Unable to resolve module buffer from D:\\ProjectABC\\node_modules\\safe-buffer\\index.js: Module does not exist in the module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache."

Used it like the example using require, and even tried import - same result. Also installing the module 'buffer' seperately doesnt help anything. I guess it's deprecated?

eugenehp commented 7 years ago

Hey @thexbasic thanks for the report. What version of RN are you using? Also are you using NPM or YARN?

kledk commented 7 years ago

Same here: react-native info:

Environment: OS: macOS Sierra 10.12.6 Node: 6.11.1 Yarn: 1.1.0 npm: 3.10.10 Watchman: 4.7.0 Xcode: Xcode 9.0 Build version 9A235 Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) react: 16.0.0 => 16.0.0 react-native: 0.49.1 => 0.49.1

cmeiller commented 7 years ago

Same here!

Yarn 1.1.0 React 16.0.0-beta.5 React-native 0.49.1

amitsystech commented 6 years ago

Yarn 1.1.0 React 16.0.0-beta.5 React-native 0.49.1

same issue

nimabk82 commented 6 years ago

I had same problem and npm i buffer solved my issue. https://github.com/bartonhammond/snowflake/issues/98

ArthurAttout commented 6 years ago

Will this ever be fixed ?

amagid commented 6 years ago

So I just had this issue and have been looking into it - it looks like this module breaks because it requires the "randombytes" module, which requires "safe-buffer", which in turn requires "buffer". "Buffer" is a Node standard library api, meaning that it ships by default with an installation of Node. Problem is, Node standard library modules are largely written in C++ like the rest of Node, and are not written in Javascript like most NPM modules. Since React Native has no capability for running C++ code, "buffer" doesn't work, and hence neither does this package.

As far as I can tell, @eugenehp can fix this issue by removing randombytes from the implementation, swapping it out with a module that performs the same function but is written specifically for React Native. I haven't checked, but this one might work:

https://github.com/mvayngrib/react-native-randombytes

eugenehp commented 3 years ago

Fixed in new 2.0.0 release.