# SerialCommand.js Error: Module version mismatch

**URL:** https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851
**Category:** Getting Started
**Created:** [October 28, 2016, 5:31pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851 "2016-10-28T17:31:37Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![neilh20](https://avatars.discourse-cdn.com/v4/letter/n/c0e974/32.png) [@neilh20](https://community.particle.io/u/neilh20)
#### Post date: [October 28, 2016, 5:31pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/1 "2016-10-28T17:31:37Z")

</div>

Hi I'm new to using node/npm, and need to configure new Photons/Electron over USB.  
When I follow the instruction with newly installed node.js/Win10 I get the following when I execute

> particle setup.

SerialCommand.js Error: Module version mismatch. Expected 48, got 46.

> node -v  
> v6.9.1  
> npm -v  
> 3.10.8

I think its something to do with a mismatched versions, but I can't see how I rebuild.  
Many thanks for any insight.

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [October 28, 2016, 7:29pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/2 "2016-10-28T19:29:32Z")

</div>

Have you used the Windows CLI Installer?  
[https://binaries.particle.io/cli/installer/windows/ParticleCLISetup.exe](https://binaries.particle.io/cli/installer/windows/ParticleCLISetup.exe)

---

<div class="post-metadata">

### Author: ![neilh20](https://avatars.discourse-cdn.com/v4/letter/n/c0e974/32.png) [@neilh20](https://community.particle.io/u/neilh20)
#### Post date: [October 28, 2016, 7:31pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/3 "2016-10-28T19:31:58Z")

</div>

Yes - tried it this morning. It doesn’t appear to be referenced anywhere in the documentation, but was listed in a Sept5 posting.

---

<div class="post-metadata">

### Author: ![neilh20](https://avatars.discourse-cdn.com/v4/letter/n/c0e974/32.png) [@neilh20](https://community.particle.io/u/neilh20)
#### Post date: [October 29, 2016, 5:06pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/4 "2016-10-29T17:06:55Z")

</div>

Just wondering if there are any other suggestions.  
It seems like this is an internal consistency error with the downloaded environment. I have spent about 4hrs total trying to get this environment up, from researching, looking for more uptodate examples, and looking at other similar errors and trying out potential solutions.  
many thanks

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [October 29, 2016, 5:29pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/5 "2016-10-29T17:29:26Z")

</div>

Does `npm install -g serialport` or `npm update -g serialport` change anything?

---

<div class="post-metadata">

### Author: ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)
#### Post date: [October 29, 2016, 5:39pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/6 "2016-10-29T17:39:39Z")

</div>

@ScruffR I just did a fresh install of Windows 10.

I installed Node 7.

I installed the Particle CLI via the Windows Installer and got a bunch of errors, one of those first errors was the Serial issue others were also having.

I just tried to run the **npm update -g serialport** in the Node Js Command window but it throws a bunch of errors also. Should I not be using Node 7.0?

Do the errors make any sense to you?

```
C:\Users\RWB>npm install -g serialport
C:\Users\RWB\AppData\Roaming\npm\serialport-list -> C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\bin\serialport-list.js
C:\Users\RWB\AppData\Roaming\npm\serialport-term -> C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\bin\serialport-terminal.js

> serialport@4.0.3 install C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport
> node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download: https://github.com/EmergingTechnologyAdvisors/node-serialport/releases/download/4.0.3/serialport-v4.0.3-node-v51-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for serialport@4.0.3 and node@7.0.0 (node-v51 ABI) (falling back to source compile with node-gyp)

C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" clean ) else (node "" clean )

C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" configure --fallback-to-build --module=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release\serialport.node --module_name=serialport --module_path=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release ) else (node "" configure --fallback-to-build --module=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release\serialport.node --module_name=serialport --module_path=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:449:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:404:11
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:111:15)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\RWB\\AppData\\Roaming\\npm\\node_modules\\serialport\\build\\Release\\serialport.node" "--module_name=serialport" "--module_path=C:\\Users\\RWB\\AppData\\Roaming\\npm\\node_modules\\serialport\\build\\Release"
gyp ERR! cwd C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport
gyp ERR! node -v v7.0.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release\serialport.node --module_name=serialport --module_path=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Windows_NT 10.0.14393
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\RWB\\AppData\\Roaming\\npm\\node_modules\\serialport\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport
node-pre-gyp ERR! node -v v7.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.30
node-pre-gyp ERR! not ok
Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release\serialport.node --module_name=serialport --module_path=C:\Users\RWB\AppData\Roaming\npm\node_modules\serialport\build\Release' (1)
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "serialport"
npm ERR! node v7.0.0
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE

npm ERR! serialport@4.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serialport@4.0.3 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the serialport package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs serialport
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls serialport
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\RWB\npm-debug.log

C:\Users\RWB>
```

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [October 29, 2016, 6:23pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/7 "2016-10-29T18:23:33Z")

</div>

The problem with `serialport` is that it might lag behind the version of `node` (at least the prebuilt binaries).  
So for some packages it’s best to wait with upgrading `node` till they are upgraded too (or have a compiler installed to build your own from source).

---

<div class="post-metadata">

### Author: ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)
#### Post date: [October 29, 2016, 7:00pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/8 "2016-10-29T19:00:21Z")

</div>

@ScruffR I deleted Node 7.0 and installed Node 6.9.1 and then ran the Particle Windows CLI installer and it’s finally working!! 😃

I’m am glad it forced me to start with a fresh copy of Windows 10 since I cleared out tons of old files I no longer use.

Hopefully the Particle Dev install works without a hitch also now 😄

---

<div class="post-metadata">

### Author: ![neilh20](https://avatars.discourse-cdn.com/v4/letter/n/c0e974/32.png) [@neilh20](https://community.particle.io/u/neilh20)
#### Post date: [November 1, 2016, 7:01pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/9 "2016-11-01T19:01:41Z")

</div>

So just wondering is the recommendation to do a fresh install of Windows10?

Is there no way to clean out the node and npm and start again.?

---

<div class="post-metadata">

### Author: ![RWB](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/rwb/32/22599_2.png) [@RWB](https://community.particle.io/u/RWB)
#### Post date: [November 1, 2016, 9:28pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/10 "2016-11-01T21:28:08Z")

</div>

I only did a fresh install of Windows 10 because nothing else I tried allowed me to run Particle CLI or Particle DEV.

I did something to the file structure when I was trying to install the Google Cloud tutorial which prevented the Particle applications from running.

The last thing I wanted to do was wipe the laptop clean, but in the end, I’m happy I’ve updated, and the computer is clean again.

---

<div class="post-metadata">

### Author: ![ctmorrison](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ctmorrison/32/7396_2.png) [@ctmorrison](https://community.particle.io/u/ctmorrison)
#### Post date: [November 10, 2016, 1:02pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/11 "2016-11-10T13:02:07Z")

</div>

So…I updated node yesterday to 6.9.1 and no longer have access to the “serial” command. When I do

```
[Toms-MacBook-Pro:~] tom% particle help
Error loading command /usr/local/lib/node_modules/particle-cli/commands/SerialCommand.js Error: Module version mismatch. Expected 48, got 46.

```

Node and npm seem to be current:

```
[Toms-MacBook-Pro:~] tom% node -v
v6.9.1
[Toms-MacBook-Pro:~] tom% npm -v
3.10.8

```

Trying to update serialport seemingly does nothing:

```
[Toms-MacBook-Pro:~] tom% sudo npm update -g serialport
Password:
[Toms-MacBook-Pro:~] tom%

```

I often use the particle serial command to monitor troubleshooting output from my device. So even though I can likely flash via DFU, I really want the serial command to work again. Thoughts?

---

<div class="post-metadata">

### Author: ![ctmorrison](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ctmorrison/32/7396_2.png) [@ctmorrison](https://community.particle.io/u/ctmorrison)
#### Post date: [November 10, 2016, 1:10pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/12 "2016-11-10T13:10:53Z")

</div>

should I uninstall node and npm and re-install both?

---

<div class="post-metadata">

### Author: ![Moors7](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/moors7/32/588_2.png) [@Moors7](https://community.particle.io/u/Moors7)
#### Post date: [November 10, 2016, 1:33pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/13 "2016-11-10T13:33:44Z")

</div>

Try reinstalling the CLI first, that might be sufficient.

---

<div class="post-metadata">

### Author: ![ctmorrison](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ctmorrison/32/7396_2.png) [@ctmorrison](https://community.particle.io/u/ctmorrison)
#### Post date: [November 10, 2016, 4:47pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/14 "2016-11-10T16:47:26Z")

</div>

@Moors7, looks like that’s going to do it. I had to uninstall first with the following command:

```
npm uninstall -g particle-cli

```

and then install with:

```
npm install -g particle-cli

```

and I appear to be back in business–at least the command is now listed and it seems to be performing as expected so far.

I don’t know what I did to screw things up, other than upgrade node.js. If that’s a likely cause, then perhaps the documentation should suggest the above procedure. I have noticed others experiencing the same issue.

As always, thank you for your quick advice!

---

<div class="post-metadata">

### Author: ![neilh20](https://avatars.discourse-cdn.com/v4/letter/n/c0e974/32.png) [@neilh20](https://community.particle.io/u/neilh20)
#### Post date: [November 10, 2016, 11:50pm UTC](https://community.particle.io/t/serialcommand-js-error-module-version-mismatch/26851/15 "2016-11-10T23:50:06Z")

</div>

Hey that worked for me as well now.  
I made sure I did it in Admin privilege as well.
