Using serialport module with meteor 1.3


#1

I’ve installed serialport module with this command
meteor npm install --save serialport

Now, i want to use the module, but when i do a
import SerialPort from 'serialport';

in my module, i’ve this error :
Error: Cannot find module ‘fs’

Note : I’ve already installed meteor-node-stubs

Thanx for your help !


#2

Are you trying to use serialport on the client side of your app? It will only work server side, so make sure your import is only called on the server side of your Meteor app. For example:

/server/main.js:

import SerialPort from 'serialport';
console.log(SerialPort);

will work.


#3

@cyprien any update on this?