Error: Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11
ezailWang opened this issue · 1 comments
ezailWang commented
When I use bip39
,run var mnemonic =bip39.generateMnemonic();
Errors such as Title.
My package.json
{
"name": "Demo",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"postinstall": "./scripts/postinstall.sh",
"test": "jest"
},
"dependencies": {
"assert": "^1.4.1",
"bip39": "^2.5.0",
"events": "^1.1.1",
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-crypto": "^2.1.2",
"react-native-randombytes": "^3.1.0",
"readable-stream": "^1.0.33",
"stream-browserify": "^1.0.0",
"unorm": "^1.4.1",
"vm-browserify": "0.0.4"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1",
"rn-nodeify": "^10.0.0"
},
"jest": {
"preset": "react-native"
},
"react-native": {
"crypto": "react-native-crypto",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"stream": "stream-browserify",
"vm": "vm-browserify"
},
"browser": {
"crypto": "react-native-crypto",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"stream": "stream-browserify",
"vm": "vm-browserify"
}
}
postinstall.sh:
./node_modules/.bin/rn-nodeify --hack --install "assert, crypto, stream, events, vm"
andimport './shim';
also in the index.js
What configuration do I lack?
ezailWang commented
Find the problem, the "./shim "
file is executed in the wrong order and needs to be executed in the front of the index.js
file.