Can't find variable: Buffer

后端 未结 5 1349
悲&欢浪女
悲&欢浪女 2020-12-16 05:50

I\'m trying to use node modules in my react-native app, and I\'m taking the ReactNativify approach here.

I\'m all set up now, and I got the crypto package to load i

5条回答
  •  渐次进展
    2020-12-16 05:52

    I was using rn-nodeify to use node packages into my react-native project. After adding the postinstall script

        "postinstall": "./node_modules/.bin/rn-nodeify --install buffer,events,process,stream,util,inherits,fs,path,assert --hack;"
    

    I was still running into Can't find variable: Buffer . which I solved finally by importing the shim.js file into my App.js :

    import './shim';
    

    Hope it Helps ! Happy hacking.

提交回复
热议问题