I’m trying to get particle-cli running, but both on my OSX and Windows 10 machines I get the “Unexpected token {”
I’ve done all I can, reinstalled multiple times, removed my profile.json… anything else I could do? I’m trying to flash an old spark-core and I’m afraid without the CLI I cannot do much.
thanks!
UPDATE: Following instructions on this thread I replaced my settings.js and now I get:
$ particle
! Error in particle-cli:
! Cannot find module './lib/deviceSpecs'
! See /Users/ignacioverona/.particle/error.log for more info.
Is there another solution to this? I cant use GIT and i cant reformat my PC which seem to be the only 2 solutions offered. This just happened to me overnight, yesterday everything was working , today I get : “Unexpected token {” on every particle command, tried to reboot and reninstall particle CLI but no change.
Its very critical i get this working, have flown to a customer to install their robot and now I’m stuck.
I even can’t compile locally using Workbench alpha7.
After deleting AppData\Local\particle, workbench reinstalled this packages, then it worked one time until trying cloud flash, then it was broken again (“Unexpected token {” on every particle command).
Using particle-cli v1.37.0 on macOS and Ubuntu without any problems. I suspect it’s something wrong with v1.38.0. Going to update to v1.38.0 on Ubuntu and see if particle-cli breaks.
Update:
Updating to v1.38.0 didn’t break particle-cli.
It’s worth noting that I’ve always installed particle-cli with:
hey all - apologies for the bumps here. i think the issue has been resolved. can you try running particle version and confirm you are error-free?
the problem appears to be related to the update mechanism - it doesn’t handle unexpected server responses well - otherwise v1.38.0 is ok (iow, downgrading isn’t going to help)
i’ll get it sorted
if you are a Workbench user and you’ve deleted your ~/.particle directory, you can do the following to get things back in order:
launch VSCode
you may be prompted to install dependencies, click “install” and wait for it to complete
run the Particle: Update CLI command and wait for it to complete
in the terminal panel that was launched, type particle version and confirm you are running v1.38.0
EDIT: if you’ve installed the CLI using our installers (docs), you may need to reinstall to get back up and running. the easiest way to do that is:
on windows:
open a file explorer and navigate to C:\Users\<you>\AppData\Local\particle
remove the following directories: .npm-cache, node_modules, node-v5.4.1-windows-x64
open a powershell terminal and type particle version
on mac & linux:
open a terminal
go to your particle directory cd ~/.particle
remove cli dependencies rm -rf ./node-v5.4.1-darwin-x64 ./.npm-cache ./node_modules (or linux as appropriate)
run particle version
in both cases, you should see the “particle: Installing plugins…” message followed after some delay by 1.38.0.
Please turn off the auto update feature of your CLI, it has cost thousands of man hours around the world. We should be allowed to choose when to update during non critical times.
No need to copy Windows 10 up-hate methods .
As it so happens, there is a way to disable automatic updating in the CLI. You can do so by setting the environment PARTICLE_DISABLE_UPDATE=true. From there, run particle update-cli manually when you feel the need.