React app crashing when trying to import module

92 Views Asked by At

Im trying to create a react that uses the 'mineflayer' module. This is my code, the function is not being run, but just having the import crashes the app;

import mineflayer from 'mineflayer';

function createBot(account) {
    const bot = mineflayer.createBot({
        host: 'localhost',
        username: 'Bot',
        auth: 'microsoft'
    });
    account.setBot(bot);
}

I also tried some other different ways of importing it

import { mineflayer } from 'mineflayer';
const mineflayer = require('mineflayer');

with no luck. This is my error:

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I'm new to both stack overflow and react, please be nice if this is a dumb question.

I tried different ways of importing it, and im expecting it to not crash.

0

There are 0 best solutions below