Closed bitabs closed 6 years ago
hey @NaseebullahSafi, can you check if you have node_modules/asyncstorage-down
, and if not, install it?
I don't have it. But I thought RN-noteify can do that automatically no? @mvayngrib
DO I comment it form WS and install it in my node-modules?
looking at the code, i see that it's a peer dependency of react-native-level-fs
so it needs to be installed manually in your project (if you need to use fs
, which maybe ws
does?)
that said, i'm still not sure ws
will work in React Native, but you tell me :)
Hmm, give me a sec, I'll get back to you.
does your package.json have a block that looks like this?
"react-native": {
...
"http": "react-native-http",
"https": "https-browserify",
if not, you might need to run rn-nodeify --install --hack
(or whatever rn-nodeify command you're running)
keep in mind that any time you install or uninstall a dependency, you need to re-run rn-nodeify
Ah I see, ok will do that. Thanks, got few more errors, if I can fix them, I'll close the issue. Thanks
can you paste the complete stack?
I don't know why but the error is gone, and not showing up anymore. It's so weird.
probably you just needed to restart the packager. It caches a lot of things
Sorry for that, I got it again. Here's the full error: @mvayngrib
And here's my package.json for react-native:
Ok nevermind that is fixed :)
@mvayngrib One of my module requires noble
. How can I shim this or use rn-nodeify? It doesn't work. Can you please specify the correct order of installing noble. The readme is quite confusing to me. Sorry
@NaseebullahSafi sorry, no idea, this is out of scope of rn-nodeify. Also, idk what platform you're developing for, but I see they don't support Android and iOS.
Yes I really needed noble for BLE for android. the library (https://github.com/jacobrosenthal/react-native-ble) directed me to here
@mvayngrib Cant we use any node module in rn-nodeify?
@NaseebullahSafi no, you can use the built-in node modules ('fs', 'crypto', 'dgram' etc.), but any modules that have custom native code (non-Javascript), will not work. You'll need to create your own react-native shims for them, like others have for react-native-udp (dgram), react-native-tcp (net), react-native-crypto (crypto), react-native-ecc (elliptic curve crypto), etc.
So cant we use rn-nodefiy on this (https://github.com/jacobrosenthal/react-native-ble)? Since they've done it already
according to the author of react-native-ble
, you can. I'm just saying rn-nodeify
doesn't support arbitrary native modules out of the box. Each module with native components needs its own shim. In this case, rn-nodeify
doesn't support noble
out of the box, which is why react-native-ble
was created. I have never played with react-native-ble
myself, so I suggest you follow the instructions on the react-native-ble
README and ask the author for help troubleshooting it. Good luck!
@mvayngrib Sorry for the trouble. It works, cant believe it!!!! :) Thank you so much.
@NaseebullahSafi haha, I'm glad to hear it, and you're welcome :) Good luck with your project!
@NaseebullahSafi How did you fix the asyncstorage-down problem? Thanks!
I have the same error ... Can anyone explain how to fix this ?
@Philipwzj @hzburki do you have asyncstorage-down installed? If not, install it manually (npm i -S asyncstorage-down
) and then re-run your rn-nodeify script.
@mvayngrib Thank you ... had to install react-native-level-fs as well, then install rn-nodeify on my machine globally and run both the --hack and --install commands. App runs okay now.
But I don't understand why this issue appeared? its a new project only one screen with text on it. I installed react-native-elements and vector-icons. Worked on the folder setup a bit and boom ... couldn't resolve modules.
Is this a bug in NPM ? Whenever you have time can you please explain this in a bit detail. Thanks 😄
@hzburki it's partially the way dependencies work: asyncstorage-down isn't automatically installed because it's a peer dependency of react-native-level-fs, not a direct dependency. Peer dependencies need to be installed explicitly in the top level project, which can be annoying, but on the other hand, it prevents multiple versions of asyncstorage-down from appearing in the dep tree.
...and partially the way the RN packager works:
webpack/browserify/RN packager all have to deal with the same problem: Node.js has core modules (fs, path, process, dgram, net, querystring, crypto, etc.), which don't exist in other native environments (browser, ios javascript engine, android javascript engine). Webpack and browserify have long relied on a set of "shims" supplied by the community: path-browserify, crypto-browserify, browserify-http, etc., and provided ways to set up module resolution to work. The RN project owners and community have so far cared much less about creating a Node.js-like environment in React Native, and thus you have modules like rn-nodeify trying to bridge the gap.
Same problem after install the nodejs ftp package I solved the problem as follow (all commands with sudo on macOS) npm install asyncstorage-down react-native link asyncstorage-down (important) ./node_modules/.bin/rn-nodeify --hack --install cd ios/ pod install react-native run-ios
asyncstorage-down is in peerDependencies, so needs to be installed manually
npm install asyncstorage-down
yes
react-native link asyncstorage-down (important)
absolutely not! asyncstorage-down is a pure JS module, only modules with ios/android native code need react-native link
Hi there,
I'm running React Native and one of the module
ws
is throwing this error:How can I resolve this?
Thanks