philikon / ReactNativify

How to use node.js libraries in React Native
242 stars 23 forks source link

Cannot find module 'react-native/packager/blacklist' #15

Open lattice0 opened 6 years ago

lattice0 commented 6 years ago

I see in your example that you use android or ios with gradle. I'm using expo for now but of course I'll migrate to gradle. For now, I copied your transformer.js, rn-cli.config, global.js and did npm3 install node-libs-browser. Here's the error I'm having when I do npm start

***ERROR STARTING PACKAGER***
Starting React Native packager...

module.js:545
    throw err;
    ^

Error: Cannot find module 'react-native/packager/blacklist'
    at Function.Module._resolveFilename (module.js:543:15)
    at Function.Module._load (module.js:470:25)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/project/src/jscam/rn-cli.config.js:3:19)
    at Module._compile (module.js:649:30)
    at Module._extensions..js (module.js:660:10)
    at Object.require.extensions.(anonymous function) [as .js] (/home/project/src/jscam/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
lattice0 commented 6 years ago

I did the "eject" and in the 'native' way I can run the app if I rename rn-cli.config.js to something else, but if I name it to what it's supposed to be, then I get:

ERROR ignorePattern is not a function

on Metro, and the app won't launch (red screen with errors)

JerellDR commented 5 years ago

For those who are still looking for a solution to this.

https://github.com/facebook/react-native/issues/7271

Vanclief commented 5 years ago

TLDR:

const blacklist = require('metro/src/blacklist');

GuillaumeMunsch commented 5 years ago

If you have react-native >= 0.57 check this:

https://github.com/facebook/react-native/issues/21093#issuecomment-420960801