CLI dead in the water, some kind of javascript problem?

I am dead in the water on Particle CLI. It’s been boned like this for a month or so, but now I really need it to load firmware on a device. Obviously I can’t uninstall. Other commands result in similarly verbose and nonsensical problems.

MacBook-Pro:productname_test_fw username$ npm uninstall -g particle-cli
/usr/local/lib/node_modules/npm/lib/utils/unsupported.js:28
        console.error(`a bug known to break npm. Please update to at least ${r
                      ^
SyntaxError: Unexpected token ILLEGAL
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at /usr/local/lib/node_modules/npm/bin/npm-cli.js:19:21
    at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
    at Module._compile (module.js:460:26)
MacBook-Pro productname_test_fw username$

The best way to work around this is to remove just the particle app. Do a:

which particle

and then remove that file, or maybe just rename it to something like particle-old.

Then reinstall the Mac Particle CLI using the CLI installer:

bash <( curl -sL https://particle.io/install-cli )

The Mac CLI installer creates a separate copy of node for its own use so it won’t mess with your node configuration. Also, it no longer requires sudo. The side benefit of this is that it will ignore your current broken global (-g) particle-cli install as long as you call the correct one.

2 Likes

Thanks @rickkas7 that seems to have worked.

1 Like