Particle module 'serialport'

Hi, this is my first post on the community. Few weeks ago, I had the alarm:

! Error loading module ‘serialport’: Cannot find module 'object.assign’
Please reinstall the CLI again using npm install -g particle-cli

I had to desinstall node and particle Cli. Then, I resinstall the particle CLI from the windows installer on the web site. It solved the problem

Today, for another projet, I realise that node wasn’t installed (node -v return nothing). I downloaded the last version of node and now I got the same error message by only typing particle in command prompt.

I have tried a bunch of thing of different forum. Tried to install serialport using npm install serialport and different combination. I got this warning (npm WARN saveError ENOENT: no such file or directory, open ‘C:\Users\franc\package.json’). I am not sure if it’s ok or not…

I am stuck and I don’t know what to do… I am using windows if this could help. I am working with particle since a year but I have fairly new in all this stuff.

thanks for your help!

Hi,

If you use the Windows CLI installer, you don’t need to install Node separately. Even if you do install Node, the Particle CLI installed through the installer won’t use the Node you installed. It uses its own Node.

If you get stuck with this kind of error again, you should be able to fix it by running the installer again (just install the CLI portion, no need to reinstall the drivers and other things).

1 Like

Hi,

Problem solve by reinstalling few time the particle-cli.

Thank you

Hi,
Jumping on this thread, because the same error just happened to me. CLI was working fine and spontaneously died in the last hour with the ‘serialport’ ‘object.assign’ pattern reported here (and elsewhere):

! Error loading module 'serialport': Cannot find module 'object.assign'
Please reinstall the CLI again using npm install -g particle-cli

I’m guessing a CLI back-ground auto-update has screwed up and broken the installation?
I tried a new CLI installer run, which failed.
I de-installed CLI, re-booted, and re-installed, which failed. I re-booted and re-ran particle.exe, just in case there was some locked library/dll which needed to be re-installed. Failed. In all cases, the error is the same. This is the log from the installer window, but the particle.exe re-execution reproduces the same behaviour:

Output folder: C:\Users\apt\AppData\Local\particle
Downloading build information
Create folder: C:\Users\apt\AppData\Local\particle\bin
Downloading CLI executable
Rename: C:\Users\apt\AppData\Local\Temp\nsx3122.tmp->C:\Users\apt\AppData\Local\particle\bin\particle.exe
Downloading and installing CLI dependencies. This may take several minutes...
particle: Adding dependencies... done
particle: Installing plugins...
 !    module.js:327
 !        throw err;
 !        ^
 !    
 !    Error: Cannot find module 'C:\Users\apt\AppData\Local\particle\node-v5.4.1-windows-x86\lib\node_modules\npm\cli.js'
 !        at Function.Module._resolveFilename (module.js:325:15)
 !        at Function.Module._load (module.js:276:25)
 !        at Function.Module.runMain (module.js:429:10)
 !        at startup (node.js:139:18)
 !        at node.js:999:3
module.js:327
    throw err;
    ^

Error: Cannot find module 'C:\Users\apt\AppData\Local\particle\node-v5.4.1-windows-x86\lib\node_modules\npm\cli.js'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Function.Module.runMain (module.js:429:10)
    at startup (node.js:139:18)
    at node.js:999:3

 !    exit status 1

 !    Error installing package. 
 !    module.js:327
 !        throw err;
 !        ^
 !    
 !    Error: Cannot find module 'C:\Users\apt\AppData\Local\particle\node-v5.4.1-windows-x86\lib\node_modules\npm\cli.js'
 !        at Function.Module._resolveFilename (module.js:325:15)
 !        at Function.Module._load (module.js:276:25)
 !        at Function.Module.runMain (module.js:429:10)
 !        at startup (node.js:139:18)
 !        at node.js:999:3
 !    
 !    Try running again with GODE_DEBUG=info to see more output.
Output folder: C:\Users\apt\AppData\Local\particle\bin
Extract: dfu-prefix.exe... 100%
Extract: dfu-suffix.exe... 100%
Extract: dfu-util-static.exe... 100%
Extract: dfu-util.exe... 100%
Extract: libusb-1.0.dll... 100%
Output folder: C:\Users\apt\AppData\Local\particle
Adding CLI to path
Created uninstaller: C:\Users\apt\AppData\Local\particle\Uninstall.exe

Run "particle setup" in the command line to start using the Particle CLI

This has been working without a hitch for about two months… no other changes made to my PC (that I am aware of, and I don’t let Windows auto-update).

Has the CLI update/build been broken as of about 10pm West Australian time 03-December (~7am Pacific USA)?

Any clues as to what I should do next?

Cheers,
AT

Update: I thought I’d give it one last go before giving up for the night. Re-ran just the ‘particle’ command, not the installer, and it appeared to download (which was previously working) and actually started the updates (which previously immediately failed). Left it running overnight…

A new failure mode greeted me this morning, but it at least hadn’t erased the previous download/updates like the previous mode. This time there were messages that suggested a permissions failure, so I re-ran it in an Administrator DOS window (“Command” for those too young to remember DOS). It completed!

Maybe we always need to run the particle post-install update process in an Administrator privilege state? I don’t recall doing this last time (August).

Anyway, information that may prove useful to other frustrated peeps out there!

Cheers
AT

I made the mistake of upgrading the CLI and had the same problem. Broken. Suggestions? Multiple attempts to reinstall per the command below have not yielded anything different. CLI was working well before this attempted upgrade. I have not un-installed/re-installed CLI.

Thoughts? Thanks.

! Error loading module ‘serialport’: Cannot find module 'object.assign’
Please reinstall the CLI again using npm install -g particle-cli

Windows 10

C:\Users\kevin>npm install -g particle-cli
npm WARN excluding symbolic link test\server\static\ie8-polyfill.js -> …/…/…/ie8-polyfill.js
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
C:\Users\kevin\AppData\Roaming\npm\particle -> C:\Users\kevin\AppData\Roaming\npm\node_modules\particle-cli\bin\particle.js
C:\Users\kevin\AppData\Roaming\npm
`-- particle-cli@1.27.0

I can’t make any promises, as I use Windows 7 32-bit (and am avoiding Windows 10 like the plague) but I suggest trying the CLI uninstall/re-install path.

My own experience was that Particle CLI (re)installation was required, followed by executing particle.exe (with no options), in a command window opened with Administrator privileges (ie. right click on Command icon or menu option). The CLI installation itself partially failed, but the subsequent execution of particle.exe no longer had the ‘serialport’ error, which allowed it to (slowly) complete the download and self-installation process in an Administrator privileged context.

Remove using the Uninstall option in the Control Panel|Programs and Features listing for Particle CLI.

If memory serves, when re-installing, it’s not necessary to re-install the USB drivers, only the CLI option:

The recent problem appears to be caused by a broken auto-update of Particle CLI (I think this can potentially happen whenever you use the particle.exe program), that has been unable to complete installation of the appropriate modules.

Using the ‘npm install…’ command, as recommended in the error messages, is probably not the preferred path on a Windows platform, now we have the CLI Installer. My guess is it’s intended as advice more relevant to installation on the various flavours of Linux, not Windows.

HTH!

If you have originally installd CLI via the Windows CLI Installer you should be able to update CLI from within via

particle update-cli

No idea why this isn’t documented :confused: