particle-cli: Error loading command Error: Cannot find module serialport.node

particle setup

Error loading command /usr/local/lib/node_modules/particle-cli/commands/CloudCommands.js Error: Cannot find module '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64/serialport.node'
Error loading command /usr/local/lib/node_modules/particle-cli/commands/SerialCommand.js Error: Cannot find module '/usr/local/lib/node_modules/particle-cli/node_modules/serialport/build/serialport/v1.7.4/Release/node-v46-darwin-x64/serialport.node'
readline.js:924
            throw err;
            ^

TypeError: Cannot read property 'findDevices' of undefined
    at SetupCommand.findDevice (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:298:8)
    at accountStatus (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:155:3)
    at PromptUI.switchChoice [as completed] (/usr/local/lib/node_modules/particle-cli/commands/SetupCommand/index.js:120:4)
    at PromptUI.onCompletion (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/lib/ui/prompt.js:69:10)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx/dist/rx.js:1793:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx/dist/rx.js:1730:14)
    at AnonymousObserver.tryCatcher (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx/dist/rx.js:567:29)
    at AutoDetachObserverPrototype.completed (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx/dist/rx.js:5288:56)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx/dist/rx.js:1730:14)
    at InnerObserver.onCompleted (/usr/local/lib/node_modules/particle-cli/node_modules/inquirer/node_modules/rx/dist/rx.js:3425:65)

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 16 (3 by maintainers)

Most upvoted comments

Yes, the CLI works with Node 6. If you are having issues it is most likely due to upgrading node and having some modules still compiled for the old version. If you know where the particle-cli package was installed you can force reinstalling it by deleting the files for the particle-clil package and the serialport dependency. This is the likely culprit of a weird loading errors.

I had a module version mismatch error for SerialCommand.js after I upgraded to nodejs v6. Downgrading my node version to 4.4.4 and doing a clean install of particle-cli fixed the issue.

I just had the same issue as @spr-lfeliu (Thanks!!), and solved it with his suggestion of downgrading to 4.4.4 and reinstalling particle-cli.