tradle / rn-nodeify

hack to allow react-native projects to use node core modules, and npm modules that use them
MIT License
615 stars 112 forks source link

Library keep showing unable to resolve modules 'net' ? #73

Closed viper4595 closed 5 years ago

viper4595 commented 6 years ago

Hi,

I use this library for my project: https://github.com/nayrnet/node-hikvision-api.

After implement all steps, the library keep showing up error: unable to resolve modules 'net' from /node_modules/[lib_name].

My react native version is: 0.56.0

mvayngrib commented 6 years ago

do you have react-native-tcp installed and linked? It's the shim for the net module

viper4595 commented 6 years ago

Tks for reply!

Yes, i has already installed and linkd react-native-tcp. It also working when i import to a react native js file.

mvayngrib commented 6 years ago

does your package.json have a mapping in the browser or react-native field from net to react-native-tcp? e.g.:

package.json:

...
"browser": {
  "net": "react-native-tcp"
},
...and/or...
"react-native": {
  "net": "react-native-tcp"
}
viper4595 commented 6 years ago

yes, i did it as well. My package .json has both browser and react-native with net: react-native-tcp in.

mvayngrib commented 6 years ago

if you installed anything after running rn-nodeify, you need to re-run it, as it fixes package.json browser+react-native mappings deep into the node_modules/ tree. Try re-running it and see if it helps

viper4595 commented 6 years ago

hi, i try to re-run it many times and it still does not understand my 'net' module was replaced by react-native-tcp :(

mvayngrib commented 5 years ago

@viper4595 sorry for the slow response. If you have a link to your project, i can take a quick look