# \[SOLVED\] Can't Flash Binary from CLI on MacOS, SerialCommand.js Module Version Mismatch Error, "Expected 48, got 46."

**URL:** <https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094>\
**Category:** Troubleshooting\
**Created:** [November 7, 2016, 2:08pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094 "2016-11-07T14:08:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdeliot2016](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@pdeliot2016](https://community.particle.io/u/pdeliot2016)\
**Post date:** [November 7, 2016, 2:08pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/1 "2016-11-07T14:08:53Z")

</div>

I am unable to flash binary from the CLI on MacOS. I have attempted to reinstall and update both NodeJS, particle-cli, as well as have used nvm to attempt to run this with different versions of node, and I am getting the same message:

> $ particle flash --serial electron\_firmware\_1478487240813.bin  
> Error loading command /usr/local/lib/node\_modules/particle-cli/commands/SerialCommand.js Error: Module version mismatch. Expected 48, got 46.  
> /usr/local/lib/node\_modules/particle-cli/commands/FlashCommand.js:146  
> return serial.flashDevice.apply(serial, arguments);  
> ^

> TypeError: Cannot read property 'flashDevice' of undefined  
> at Object.extend.flashYModem (/usr/local/lib/node\_modules/particle-cli/commands/FlashCommand.js:146:16)  
> at Object.extend.flashSwitch (/usr/local/lib/node\_modules/particle-cli/commands/FlashCommand.js:122:18)  
> at Object.BaseCommand.runCommand (/usr/local/lib/node\_modules/particle-cli/commands/BaseCommand.js:108:17)  
> at Object.Interpreter.runCommand (/usr/local/lib/node\_modules/particle-cli/lib/interpreter.js:100:13)  
> at Object.Interpreter.handle (/usr/local/lib/node\_modules/particle-cli/lib/interpreter.js:56:18)  
> at Object. (/usr/local/lib/node\_modules/particle-cli/bin/particle.js:20:5)  
> at Module.\_compile (module.js:541:32)  
> at Object.Module.\_extensions..js (module.js:550:10)  
> at Module.load (module.js:456:32)  
> at tryModuleLoad (module.js:415:12)

Any thoughts?

---

<div class="post-metadata">

**Author:** ![nrobinson2000](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/nrobinson2000/32/15624_2.png) [@nrobinson2000](https://community.particle.io/u/nrobinson2000)\
**Post date:** [November 7, 2016, 2:47pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/2 "2016-11-07T14:47:44Z")

</div>

What if you try using dfu-util instead?

```auto
particle flash --usb electron_firmware_1478487240813.bin

```

---

<div class="post-metadata">

**Author:** ![pdeliot2016](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@pdeliot2016](https://community.particle.io/u/pdeliot2016)\
**Post date:** [November 7, 2016, 3:10pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/3 "2016-11-07T15:10:18Z")

</div>

Well, that does get me the end goal, which is to flash the device, so thank you for that.

That being said, I still get some errors - e.g the, "Expected 48 got 46" error. I'm bothered by the fact that there is something screwy with NodeJS-particle-cli when the last time I worked with this about a month ago, there were no problems. Could it be that the most recent update of NodeJS is not compatible with particle-cli or something?

> Error loading command /usr/local/lib/node\_modules/particle-cli/commands/SerialCommand.js Error: Module version mismatch. Expected 48, got 46.  
> Found DFU device 2b04:d00a  
> checking file electron\_firmware\_1478487240813.bin  
> spawning dfu-util -d 2b04:d00a -a 0 -i 0 -s 0x08080000:leave -D electron\_firmware\_1478487240813.bin  
> dfu-util 0.9

> Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.  
> Copyright 2010-2016 Tormod Volden and Stefan Schmidt  
> This program is Free Software and has ABSOLUTELY NO WARRANTY  
> Please report bugs to [dfu-util / Tickets](http://sourceforge.net/p/dfu-util/tickets/)

> dfu-util: Invalid DFU suffix signature  
> dfu-util: A valid DFU suffix will be required in a future dfu-util release!!!  
> Deducing device DFU version from functional descriptor length  
> Opening DFU capable USB device...  
> ID 2b04:d00a  
> Run-time device DFU version 011a  
> Claiming USB DFU Interface...  
> Setting Alternate Setting #0 ...  
> Determining device status: state = dfuIDLE, status = 0  
> dfuIDLE, continuing  
> DFU mode device DFU version 011a  
> Device returned transfer size 4096  
> DfuSe interface name: "Internal Flash "  
> Downloading to address = 0x08080000, size = 23456  
> Download [=========================] 100% 23456 bytes  
> Download done.  
> File downloaded successfully

> Flash success!

---

<div class="post-metadata">

**Author:** ![nrobinson2000](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/nrobinson2000/32/15624_2.png) [@nrobinson2000](https://community.particle.io/u/nrobinson2000)\
**Post date:** [November 7, 2016, 3:57pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/4 "2016-11-07T15:57:28Z")

</div>

This error is caused by an issue with `serialport`, and is because a serialport binary for your version of node could not be found.

What happens if you try reinstalling Particle-cli using this command:

```auto
sudo npm install -g node-pre-gyp npm serialport particle-cli

```

---

<div class="post-metadata">

**Author:** ![pdeliot2016](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@pdeliot2016](https://community.particle.io/u/pdeliot2016)\
**Post date:** [November 7, 2016, 4:06pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/5 "2016-11-07T16:06:01Z")

</div>

> [@nrobinson2000](#):
>
> sudo npm install -g node-pre-gyp npm serialport particle-cli

Please see the GitHub gist showing the terminal output:

[https://gist.github.com/pwdel/15fc4aa8b29f20dbc33c13e65fc30dd3](https://gist.github.com/pwdel/15fc4aa8b29f20dbc33c13e65fc30dd3)

---

<div class="post-metadata">

**Author:** ![harrisonhjones](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/harrisonhjones/32/4132_2.png) [@harrisonhjones](https://community.particle.io/u/harrisonhjones)\
**Post date:** [November 7, 2016, 4:14pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/6 "2016-11-07T16:14:42Z")

</div>

Patrick,

It looks like it was successfully reinstalled. Do you still get the same error when you try to do a serial command?

---

<div class="post-metadata">

**Author:** ![pdeliot2016](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@pdeliot2016](https://community.particle.io/u/pdeliot2016)\
**Post date:** [November 7, 2016, 4:22pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/7 "2016-11-07T16:22:34Z")

</div>

Since I was able to accomplish uploading my firmware via DFU, I am moving on to my next issue, and currently working on getting data sent to the Google Cloud via the Particle Integration, re:

[https://docs.particle.io/tutorials/topics/google-cloud-platform/](https://docs.particle.io/tutorials/topics/google-cloud-platform/)

I will go back and connect my device to serial later today.

---

<div class="post-metadata">

**Author:** ![noumanh](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/noumanh/32/11443_2.png) [@noumanh](https://community.particle.io/u/noumanh)\
**Post date:** [February 23, 2017, 12:38pm UTC](https://community.particle.io/t/solved-cant-flash-binary-from-cli-on-macos-serialcommand-js-module-version-mismatch-error-expected-48-got-46/27094/8 "2017-02-23T12:38:47Z")

</div>

Thread is quite old but for others having this issue I can confirm that the above command fixes it. I was facing this issue after updating my node.js installation on Windows 10 for another project and suddenly my Particle CLI started reporting errors. Running the install command mentioned above fixed it right away 😄
