[ISSUE] Reinstall CLI?

I have a strange and new problem as of the other day, where CLI or the workbench had been not giving me any issues beforehand.

None of my projects are allowing me to Flash any code, nor is my CLI allowing me to reset my Particle Photon device. Whether my Photon is plugged in or not, when I run ‘Particle usb dfu’ I get only the following result:

! The `particle-usb` dependency is missing or invalid.
! Please reinstall: https://docs.particle.io/tutorials/developer-tools/cli/#installing
Cannot find module 'usb'

The link is to Particle’s page on installing CLI, so I figure that there is something wrong with the CLI. However, as much as I would like to uninstall and reinstall right away, I’m not exactly sure how to uninstall the CLI and can’t seem to find it through a few Google searches.

Also, even though compiling still works for me, I get the following error when I try flashing the code:

Cannot find module 'usb'
make: *** [C:\Users\jhdil\.particle\toolchains\buildscripts\1.6.1\Makefile:23: dfu] Error 1
The terminal process terminated with exit code: 2

Press any key to close the terminal.

The following is my audit environment:


*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

{
    "username": "jhdillenb@gmail.com",
    "workspace": {
        "name": "serial_stuff",
        "isWorkspace": false,
        "folders": [
            {
                "location": "c:\\Users\\jhdil\\OneDrive\\Desktop\\serial_stuff",
                "hasValidPath": true,
                "settings": {
                    "firmwareName": "deviceOS",
                    "firmwareVersion": "1.4.0-rc.1",
                    "targetDevice": "",
                    "targetPlatform": "photon",
                    "compileButtonAction": "localAppDeviceOS",
                    "flashButtonAction": "localAppDeviceOS",
                    "disableWelcomeScreen": true,
                    "disableLocalCompilerDirtyCheck": false,
                    "enableVerboseLocalCompilerLogging": false
                },
                "files": [
                    ".vscode",
                    ".vscode\\launch.json",
                    ".vscode\\settings.json",
                    "project.properties",
                    "README.md",
                    "src",
                    "src\\serial_stuff.cpp",
                    "src\\serial_stuff.ino"
                ]
            }
        ]
    },
    "cli": {
        "binpath": "c:\\Users\\jhdil\\.vscode\\extensions\\particle.particle-vscode-core-1.5.2\\src\\cli\\bin\\windows\\amd64\\particle.exe",
        "ok": true,
        "version": "1.44.0",
        "installed": 1567213658115
    },
    "localCompiler": {
        "ok": true,
        "dependencies": [
            {
                "id": "deviceOS@1.4.0-rc.1",
                "ok": true
            },
            {
                "id": "gcc-arm@5.3.1",
                "ok": true
            },
            {
                "id": "buildtools@1.1.0",
                "ok": true
            },
            {
                "id": "buildscripts@1.6.1",
                "ok": true
            },
            {
                "id": "openocd@0.11.1-adhoc6ea4372.0",
                "ok": true
            },
            {
                "id": "deviceOS@1.3.0-rc.1",
                "ok": true
            },
            {
                "id": "deviceOS@1.2.1-rc.2",
                "ok": true
            },
            {
                "id": "deviceOS@1.0.1",
                "ok": true
            }
        ]
    },
    "platform": {
        "os": "windows",
        "type": "Windows_NT",
        "release": "10.0.17134",
        "arch": "x64",
        "path": {
            "key": "Path",
            "value": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\Git\\cmd;C:\\Users\\jhdil\\OneDrive\\Desktop\\Old_COD_C++_Stuff\\mingw32\\bin;C:\\Program Files\\nodejs\\;C:\\Program Files\\MySQL\\MySQL Shell 8.0\\bin\\;C:\\Users\\jhdil\\Anaconda3;C:\\Users\\jhdil\\Anaconda3\\Scripts;C:\\Users\\jhdil\\Anaconda3\\condabin;C:\\Users\\jhdil\\Anaconda3\\libs;C:\\Users\\jhdil\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\jhdil\\AppData\\Roaming\\npm"
        },
        "homeDir": "C:\\Users\\jhdil",
        "particleDir": "C:\\Users\\jhdil\\.particle",
        "localCompilerToolchainDir": "C:\\Users\\jhdil\\.particle\\toolchains"
    },
    "env": {
        "ALLUSERSPROFILE": "C:\\ProgramData",
        "AMD_ENTRYPOINT": "vs/workbench/services/extensions/node/extensionHostProcess",
        "APPDATA": "C:\\Users\\jhdil\\AppData\\Roaming",
        "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "true",
        "CommonProgramFiles": "C:\\Program Files\\Common Files",
        "CommonProgramFiles(x86)": "C:\\Program Files (x86)\\Common Files",
        "CommonProgramW6432": "C:\\Program Files\\Common Files",
        "COMPUTERNAME": "DESKTOP-IVRLSBC",
        "ComSpec": "C:\\Windows\\system32\\cmd.exe",
        "DriverData": "C:\\Windows\\System32\\Drivers\\DriverData",
        "ELECTRON_RUN_AS_NODE": "1",
        "FPS_BROWSER_APP_PROFILE_STRING": "Internet Explorer",
        "FPS_BROWSER_USER_PROFILE_STRING": "Default",
        "HOMEDRIVE": "C:",
        "HOMEPATH": "\\Users\\jhdil",
        "LOCALAPPDATA": "C:\\Users\\jhdil\\AppData\\Local",
        "LOGONSERVER": "\\\\DESKTOP-IVRLSBC",
        "NUMBER_OF_PROCESSORS": "8",
        "OneDrive": "C:\\Users\\jhdil\\OneDrive",
        "OneDriveConsumer": "C:\\Users\\jhdil\\OneDrive",
        "OS": "Windows_NT",
        "Path": "C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Windows\\System32\\OpenSSH\\;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files\\Git\\cmd;C:\\Users\\jhdil\\OneDrive\\Desktop\\Old_COD_C++_Stuff\\mingw32\\bin;C:\\Program Files\\nodejs\\;C:\\Program Files\\MySQL\\MySQL Shell 8.0\\bin\\;C:\\Users\\jhdil\\Anaconda3;C:\\Users\\jhdil\\Anaconda3\\Scripts;C:\\Users\\jhdil\\Anaconda3\\condabin;C:\\Users\\jhdil\\Anaconda3\\libs;C:\\Users\\jhdil\\AppData\\Local\\Programs\\Microsoft VS Code\\bin;C:\\Users\\jhdil\\AppData\\Roaming\\npm",
        "PATHEXT": ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC",
        "PIPE_LOGGING": "true",
        "PROCESSOR_ARCHITECTURE": "AMD64",
        "PROCESSOR_IDENTIFIER": "Intel64 Family 6 Model 142 Stepping 10, GenuineIntel",
        "PROCESSOR_LEVEL": "6",
        "PROCESSOR_REVISION": "8e0a",
        "ProgramData": "C:\\ProgramData",
        "ProgramFiles": "C:\\Program Files",
        "ProgramFiles(x86)": "C:\\Program Files (x86)",
        "ProgramW6432": "C:\\Program Files",
        "PSModulePath": "%ProgramFiles%\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules",
        "PUBLIC": "C:\\Users\\Public",
        "SESSIONNAME": "Console",
        "SystemDrive": "C:",
        "SystemRoot": "C:\\Windows",
        "TEMP": "C:\\Users\\jhdil\\AppData\\Local\\Temp",
        "TMP": "C:\\Users\\jhdil\\AppData\\Local\\Temp",
        "USERDOMAIN": "DESKTOP-IVRLSBC",
        "USERDOMAIN_ROAMINGPROFILE": "DESKTOP-IVRLSBC",
        "USERNAME": "jhdil",
        "USERPROFILE": "C:\\Users\\jhdil",
        "VBOX_MSI_INSTALL_PATH": "C:\\Program Files\\Oracle\\VirtualBox\\",
        "VERBOSE_LOGGING": "true",
        "VSCODE_CWD": "C:\\Windows\\system32",
        "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
        "VSCODE_IPC_HOOK": "\\\\.\\pipe\\a629cbdb9f1fda57ff5d021a25098436-1.37.1-main-sock",
        "VSCODE_IPC_HOOK_EXTHOST": "\\\\.\\pipe\\vscode-ipc-85220e66-a717-48ad-8388-9b5680e52634-sock",
        "VSCODE_LOGS": "C:\\Users\\jhdil\\AppData\\Roaming\\Code\\logs\\20190830T205239",
        "VSCODE_LOG_STACK": "false",
        "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
        "VSCODE_NODE_CACHED_DATA_DIR": "C:\\Users\\jhdil\\AppData\\Roaming\\Code\\CachedData\\f06011ac164ae4dc8e753a3fe7f9549844d15e35",
        "VSCODE_PID": "1700",
        "VSCODE_PREVENT_FOREIGN_INSPECT": "true",
        "windir": "C:\\Windows"
    },
    "versions": {
        "http_parser": "2.8.0",
        "node": "10.11.0",
        "v8": "6.9.427.31-electron.0",
        "uv": "1.23.0",
        "zlib": "1.2.11",
        "ares": "1.14.0",
        "modules": "69",
        "nghttp2": "1.33.0",
        "napi": "3",
        "openssl": "1.1.0",
        "icu": "62.2",
        "unicode": "11.0",
        "cldr": "33.1",
        "tz": "2019a"
    },
    "vscode": {
        "appName": "Visual Studio Code",
        "appRoot": "c:\\Users\\jhdil\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "machineId": "11d4b23c0da177230f94e37c0615185bb81b8910cf43325b1412c93cf1aee13e",
        "sessionId": "32edb89c-1e00-41da-a89f-ee4e114bc41c1567268206554",
        "version": "1.37.1"
    },
    "extensions": [
        {
            "id": "ms-vscode.node-debug",
            "version": "1.35.3"
        },
        {
            "id": "ms-vscode.node-debug2",
            "version": "1.33.0"
        },
        {
            "id": "ms-vscode.references-view",
            "version": "0.0.29"
        },
        {
            "id": "austin.code-gnu-global",
            "version": "0.2.2"
        },
        {
            "id": "marus25.cortex-debug",
            "version": "0.3.1"
        },
        {
            "id": "ms-python.anaconda-extension-pack",
            "version": "1.0.1"
        },
        {
            "id": "ms-python.python",
            "version": "2019.8.30787"
        },
        {
            "id": "ms-vscode.cpptools",
            "version": "0.25.1"
        },
        {
            "id": "ms-vscode.csharp",
            "version": "1.21.1"
        },
        {
            "id": "particle.particle-vscode-theme",
            "version": "1.5.2"
        },
        {
            "id": "particle.particle-vscode-snippets",
            "version": "1.5.2"
        },
        {
            "id": "particle.particle-vscode-core",
            "version": "1.5.2"
        },
        {
            "id": "particle.particle-vscode-pack",
            "version": "1.5.2"
        }
    ]
}

*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

Should I, and how do I, uninstall and reinstall CLI? Or is there a different step I’m supposed to take to get my workbench flashing to and reseting my Photon again?

You can uninstall via the Particle Windows Installer or via Control Pannel - Add/Remove Programs and Features.

After checking the Control Panel, I saw that there had not been a Particle CLI program installed, strangely enough. So I had installed it, from using the link before mentioned, and now it is listed in my Control Panel.
Unfortunately, I still arrive at the same issue as before. "Cannot find module ‘usb’ ". :confused:

yikes. that's no fun :frowning:

not that it's much comfort to you but i'm running a very similar setup successfully here:


*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

{
    "cli": {
        "binpath": "C:\\Users\\me\\.vscode\\extensions\\particle.particle-vscode-core-1.5.2\\src\\cli\\bin\\windows\\amd64\\particle.exe",
        "ok": true,
        "version": "1.44.0",
        "installed": 1566507967036
    },
    "localCompiler": {
        "ok": true,
        "dependencies": [
            {
                "id": "deviceOS@1.4.0-rc.1",
                "ok": true
            },
            {
                "id": "gcc-arm@5.3.1",
                "ok": true
            },
            {
                "id": "buildtools@1.1.0",
                "ok": true
            },
            {
                "id": "buildscripts@1.6.1",
                "ok": true
            },
            {
                "id": "openocd@0.11.1-adhoc6ea4372.0",
                "ok": true
            },
            {
                "id": "deviceOS@1.3.1-rc.1",
                "ok": true
            },
            {
                "id": "deviceOS@1.2.1",
                "ok": true
            }
        ]
    },
    "platform": {
        "os": "windows",
        "type": "Windows_NT",
        "release": "10.0.17134",
        "arch": "x64",
        "path": {
            "key": "Path",
            "value": "C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\mingw64\\bin;C:\\Program Files\\Git\\usr\\bin;C:\\Users\\me\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\me\\AppData\\Local\\Programs\\Microsoft VS Code\\bin"
        },
        "homeDir": "C:\\Users\\me",
        "particleDir": "C:\\Users\\me\\.particle",
        "localCompilerToolchainDir": "C:\\Users\\me\\.particle\\toolchains"
    },
    "versions": {
        "http_parser": "2.8.0",
        "node": "10.11.0",
        "v8": "6.9.427.31-electron.0",
        "uv": "1.23.0",
        "zlib": "1.2.11",
        "ares": "1.14.0",
        "modules": "69",
        "nghttp2": "1.33.0",
        "napi": "3",
        "openssl": "1.1.0",
        "icu": "62.2",
        "unicode": "11.0",
        "cldr": "33.1",
        "tz": "2019a"
    },
    "vscode": {
        "appName": "Visual Studio Code",
        "appRoot": "c:\\Users\\me\\AppData\\Local\\Programs\\Microsoft VS Code\\resources\\app",
        "version": "1.37.1"
    },
    "extensions": [
        {
            "id": "ms-vscode.node-debug",
            "version": "1.35.3"
        },
        {
            "id": "ms-vscode.node-debug2",
            "version": "1.33.0"
        },
        {
            "id": "ms-vscode.references-view",
            "version": "0.0.29"
        },
        {
            "id": "marus25.cortex-debug",
            "version": "0.3.1"
        },
        {
            "id": "ms-vscode.cpptools",
            "version": "0.25.1"
        },
        {
            "id": "particle.particle-vscode-core",
            "version": "1.5.2"
        },
        {
            "id": "particle.particle-vscode-pack",
            "version": "1.5.2"
        },
        {
            "id": "particle.particle-vscode-snippets",
            "version": "1.5.2"
        },
        {
            "id": "particle.particle-vscode-theme",
            "version": "1.5.2"
        }
    ]
}

*** WARNING: MAY CONTAIN CONFIDENTIAL INFORMATION - PLEASE SANITIZE BEFORE SHARING ***
To report an issue, visit:
https://community.particle.io/t/information-how-to-report-bugs-and-provide-feedback/44245

your error:

Cannot find module 'usb'

tells me the issue is related to dependency resolution. we updated our particle-usb module which itself relies on the usb module (changelog) so something weird is happening at install time to prevent that module from being installed.

one thing you could check:

  1. open file explorer
  2. navigate to C:\Users\<your username>\AppData\Local\particle
  3. open the file named error.log
  4. share the contents here

you can also try manually resetting / reinstalling:

  1. delete the contents of C:\Users\<your username>\AppData\Local\particle
  2. open VSCode
  3. ctrl+shift+p to open the command palette
  4. select and run Particle: Update CLI
  5. wait for the update to complete

sorry for the bumps :pray:

2 Likes

@m_m, I have seen other reports (here, here and some other places which I currently can’t find) about of the latest CLI version barfing.

Could there be something up with the latest release?

ah, thanks for sharing those - i hadn’t seen them. there’s definitely something wrong w/ the particle doctor command but that’s different than what’s happening here. i’ll chime in on the threads you linked :+1:

1 Like

Unfortunately, I was unable to navigate to AppData/Local/particle using my file explorer because AppData does not appear. I do not know why, but I was able to access that location using my command prompt! However, by doing so and finding the error.log file, I did not know how to open and view that file using the command prompt. So instead I had followed your second set of instructions.

Using the command prompt, I had manually deleted many of the contents within AppData/Local/particle, ran particle update-cli, and it has worked! My output no longer tells me that it cannot find module ‘usb’!

1 Like

glad that got you back in working order. again, sorry for the bumps :pray: fwiw, i’m looking at how to make this update process more reliable. thanks for the report :+1:

You can type %localappdata% in the address bar in Explorer.
AppData is hidden by default, but you can tick the checkbox View - Show hidden files to make it visible.

You could run notepad error.log from the command line or even do explorer . to open the Explorer at the current folder.

1 Like