I get an error "Error: Cannot find module 'yallist'" when trying to compile code that compiled before

My code was compiling using Workbench, then I made a few short code changes, adding 2 libraries and started to get the below errors. Then I reverted all those changes (removing the library references), and still kept getting the same errors, that were not there originally.

The error log is as follows when I compile:
Error: Cannot find module 'yallist'
Require stack:

  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\lru-cache\index.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\semver\classes\range.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\semver\classes\comparator.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\semver\index.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\src\lib\has-supported-node.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\src\index.js
  • C:\Users\astro\AppData\Local\particle[eval]
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1026:15)
    at Function.Module._load (node:internal/modules/cjs/loader:871:27)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object. (C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\lru-cache\index.js:11:15)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32)
    at Function.Module._load (node:internal/modules/cjs/loader:909:12)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    2023/10/18 16:43:46 Time since last update 2h25m45.1893693s, update in background

The build errors in the Visual Studio Code are:

  • C:\Users\astro\AppData\Local\particle[eval]
    ! See C:\Users\astro\AppData\Local\particle\error.log for more info.
    make[1]: *** [C:\Users\astro.particle\toolchains\buildscripts\1.15.0\Makefile:38: c:/Users/astro/Dropbox/AquaRealTime/Engineering/Git/TrackerCommsV2/src/TrackerCommsV2.cpp] Error 1
    make: *** [C:\Users\astro.particle\toolchains\buildscripts\1.15.0\Makefile:87: compile-user] Error 2
  • The terminal process "C:\Users\astro.particle\toolchains\buildtools\1.1.1\bin\bash.exe '-c', 'make -f 'C:\Users\astro.particle\toolchains\buildscripts\1.15.0\Makefile' compile-user -s'" terminated with exit code: 2.

Thanks for any help with this. In the past I got other 'yallist' errors, and I uninstalled workbench and MS Visual Studio Code, and re installed them, but this just happened again, so going through those re-installs evidently are not a permanent fix.

Hi @astroyam Sorry you are running into this problem. As of right now, could you try the following troubleshooting doc Troubleshooting the Particle CLI | Troubleshooting | Particle and see if you are able to resolve the issue? Thanks for bringing this to our attention!

Hi there keerthy5,
When I do the first test 'particle login', I get the same 'yallist' error:

C:\Users\astro\Dropbox\AquaRealTime\Engineering\Git\TrackerCommsV2>particle login
! Error in particle-cli:
! Cannot find module 'yallist'
Require stack:

  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\lru-cache\index.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\semver\classes\range.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\semver\classes\comparator.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\node_modules\semver\index.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\src\lib\has-supported-node.js
  • C:\Users\astro\AppData\Local\particle\node_modules\particle-cli\src\index.js
  • C:\Users\astro\AppData\Local\particle[eval]
    ! See C:\Users\astro\AppData\Local\particle\error.log for more info.

Does this help?

I faced the same problem after a Windows upgrade. The solution is to deinstall particle-cli and reinstall it from the official website: https://binaries.particle.io/cli/installer/windows/ParticleCLISetup.exe

1 Like