Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find variable: Buffer even after required 'node-libs-react-native/globals' #4

Open
longsangstan opened this issue Feb 2, 2018 · 3 comments

Comments

@longsangstan
Copy link

Sorry it is probably a beginner mistake. I followed the docs and required 'node-libs-react-native/globals' in my app like this:

// index.js

require('node-libs-react-native/globals');

import { AppRegistry } from 'react-native';
import App from './App';

AppRegistry.registerComponent('MyApp', () => App);

But the error of "Can't find variable: Buffer" is still showing. I added the rn-cli.config.js file already.

What am I missing? Thanks.

@parshap
Copy link
Owner

parshap commented Feb 5, 2018

@longsangstan: Imports get hoisted above require() calls, so try using import 'node-libs-react-native/globals' or moving everything into App.js and doing require('./App').

@developeromI89
Copy link

So how it resolved .

@quybeans
Copy link

quybeans commented Jun 23, 2021

So how it resolved

add this line before everything starts.

import 'node-libs-react-native/globals

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants