Skip to content Skip to sidebar Skip to footer

Error: Fs.readfilesync Is Not A Function

I am trying to flash a hex file to an Arduino through a Chrome app I am making. I used basic NodeJS code, which is below, and converted it using browserify so that it would work in

Solution 1:

You can't run this type of code in a browser (even with browserify). You should be running it in node.js.

I would guess that your error is coming from inside of:

avrgirl.flash('Blink.cpp.hex', ...)

since you're passing a filename and that function is likely trying to read that file.

browserify cannot magically give a browser powers that it otherwise would not have such as reading files from your hard drive or communicating with arduino hardware. This code was probably meant to be run in the node.js environment.

The instructions for the avrgirl-arduino module, pretty clearly state you should be running in node.js.

Solution 2:

I know this is quite old but: Noopkat has made an avrgirl demo that uses webserial to flash board from the browser! Check it out. https://github.com/noopkat/avrgirl-arduino/tree/master/tests/demos/webserial

Post a Comment for "Error: Fs.readfilesync Is Not A Function"