Skip to content

Unable to resolve module fs from [Location]: Module does not exist in the module map #165

@bitabs

Description

@bitabs

I'm trying to use OpenBCI Cyton in react native application. However the issue is that I can't import it in react native. Is there a way to use Cyton in react native?

This is the error I get:

Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `fs` from `C:\King's_College_London\Final_Year_Project\HeartFailure\node_modules\serialport\lib\serialport.js`: Module does not exist in the module map

and I try to use it like so:

import Cyton from 'openbci-cyton';

  const ourBoard = new Cyton();
  ourBoard.connect("COM3").then(() => {
    ourBoard.on('ready', () => {
      ourBoard.streamStart();
      ourBoard.on('sample', (sample) => {
        for(let i = 0; i < ourBoard.numberOfChannels(); i++) {
          console.log(
            "Channel" + (i + 1) + ": " + sample.channelData[i].toFixed(8) + " Volts."
          );
        }
      });
    });
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions