Particle cli update 2.0.0 broken

Running MacOS Mojave, 10.14.6.

Just updated to particle cli in the normal way (I think it was v2.0.0). Problem is that I now cannot run any commands, eg "particle", from the command line!

All attempts return the following:

$ particle
/usr/local/lib/node_modules/particle-cli/dist/app/cli.js:144
async runCommand(args) {
^^^^^^^^^^
SyntaxError: Unexpected identifier
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/usr/local/lib/node_modules/particle-cli/dist/index.js:8:13)

Any clues?

Tried updating npm as sudo

Before:

$ npm version
{ npm: '3.10.10',
ares: '1.10.1-DEV',
http_parser: '2.7.0',
icu: '58.2',
modules: '48',
node: '6.11.1',
openssl: '1.0.2k',
uv: '1.11.0',
v8: '5.1.281.103',
zlib: '1.2.11' }

After:

$ npm version
{ npm: '6.13.4',
ares: '1.10.1-DEV',
http_parser: '2.7.0',
icu: '58.2',
modules: '48',
node: '6.11.1',
openssl: '1.0.2k',
uv: '1.11.0',
v8: '5.1.281.103',
zlib: '1.2.11' }

but still no joy....

How did you do the update $ particle update-cli ? Are you using Bash or Zshell?

I had a few issues with macOS Catalina but not Mojave.

@armor, thanks for pitching in.

I ran particle update-cli (which I can’t run anymore). It instructed me to run something like npm update.

Am using the bash shell script.

Do you think I should try uninstalling and then re-install particle cli?

FIXED!

Updated node from

$ node -v
v6.11.1
$ npm -v
6.13.4

to

$ node -v
v12.13.1
$ npm -v
6.12.1

I note the npm was downgraded in the node upgrade process but no matter.

Glad to see you got it solved.

glad you got things back to working :+1:

fwiw, this is one of the reasons we recommend using our installer - it manages the backing node instance for you:

https://docs.particle.io/tutorials/developer-tools/cli/#installing

if you prefer the “advanced” path where you manage the node runtime yourself, read on.

the node ecosystem adheres (more or less) to SemVer (https://semver.org/). Amongst other rules, SemVer specifies that you should bump the major version number when introducing breaking changes. in this case, our move to particle-cli@2.0.0 signals just such a breaking-change - which is simply that we no longer support node@6.

in general, we aim to support the current node LTS (long-term support) lines:

…which at the time of this posting is v12, v10, and v8.

v6 LTS ended back in april (4/30/2019 specifically) - as shown here - which is why we dropped it.

@m_m, great notes. It all makes sense.

Case closed!

1 Like

@UMD or @m_m,

I am having issues with particle-cli that I believe may be related to version.
node - v10.15.3
npm - v6.10.1
I am running Mac Catalina and have tried both BASH and zsh no difference in the error message when I run the “particle identify” command with a device in listening mode on my USB port:

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

I followed the instructions here already.

Some questions:

  1. How do I update node and npm on a Mac
  2. Is there anything else I should try?

Thanks,

Chip

@chipmc try the instructions over here and let me know how it goes?

@m_m,

Thank you for the suggestion. I have two questions before I try to reinstall particle-cli and I think they are related:

  1. There was no .node-* directories under ~/.particle - Node is somewhere else?
  2. I always have to type sudo before particle update-cli or it does not work.

Do I have a “global” node issue? If so, how do I fix it?

Thanks, Chip

There was no .node-* directories under ~/.particle - Node is somewhere else?

are you on Windows? if not, then i'm guessing you used the "Advanced" install method
(docs) when you originally installed the CLI.

unless you are comfortable using node.js, i would recommend the standard install path. unfortunately, moving from one to the other requires some work to uninstall the global node.js runtime and the particle-cli package. to start, you'd run npm uninstall -g particle-cli.

I always have to type sudo before particle update-cli or it does not work.

this speaks to having previously installed using the "Advanced" instructions - you shouldn't need to use sudo when installing packages. that you do, speaks to some misconfiguration of your local node.js environment.

Do I have a “global” node issue?

sounds like it.

how do I fix it?

there are all sorts of guides out there with instructions on how to install and configure node.js - here's one that seems good:

if you are on a mac, i personally recommend using Homebrew to install and manage node.js:

@m_m,

Appreciate the help and some progress.

Uninstalled node using the first article and - as the article suggested - reinstalled via NVM.
node - 13.6.0
npm 6.13.4

But the particle update-cli command fails as it seems to be looking for the directories that we deleted in the post you first linked to.

Here is a subset:

particle: Installing plugins (retrying)...
 â–¸    Error installing package. 
 â–¸    npm WARN checkPermissions Missing write access to /Users/chipmc/.particle/node_modules/particle-cli
 â–¸    npm WARN checkPermissions Missing write access to /Users/chipmc/.particle/node_modules/particle-cli/node_modules
 â–¸    npm WARN checkPermissions Missing write access to /Users/chipmc/.particle/node_modules/particle-cli/node_modules/fsevents/node_modules
 â–¸    npm WARN enoent ENOENT: no such file or directory, open '/Users/chipmc/.particle/package.json'
 â–¸    npm WARN .particle No description
 â–¸    npm WARN .particle No repository field.
 â–¸    npm WARN .particle No README data
 â–¸    npm WARN .particle No license field.

I checked and I have read & write privileges to .particle

I also tried to install the particle CLI using bash <( curl -sL https://particle.io/install-cli ) - got the same errors.

I am assuming that putting sudo back in would likely fix it but, I would prefer not to. Any advice?

Thanks, Chip

Uninstalled node using the first article and - as the article suggested - reinstalled via NVM

as i said earlier, if you aren't comfortable managing a local node.js installation, i would stick to the standard Particle CLI install path (docs). iow, completely remove the global node.js install and install the CLI using those instructions.

I am assuming that putting sudo back in would likely fix it but, I would prefer not to. Any advice?

just what i've shared here already and to be 100% certain your permissions are set appropriately:

@m_m,

OK, sorry, I misunderstood your instructions - my fault.

I have completely uninstalled node and then used the instructions from the doc (Mac Catalina). I am getting the same errors but, let me focus on one line as this might point to the cause.

I looked at my permissions for the ~/.particle directory and see this:

drwxr-xr-x    9 chipmc  staff   288B Jan 10 16:47 .
drwxr-xr-x+  44 chipmc  staff   1.4K Jan 10 16:46 ..
drwxr-xr-x    6 chipmc  staff   192B Jan 10 14:52 .npm-cache
-rw-r--r--    1 chipmc  staff    54B Jan 10 14:36 autoupdate
-rw-r--r--    1 chipmc  staff   330K Jan 10 16:47 error.log
drwxr-xr-x    9 chipmc  staff   288B Mar  8  2019 node-v8.15.0-darwin-x64
drwxr-xr-x  438 chipmc  staff    14K Jan  8 11:13 node_modules
-rw-r--r--    1 chipmc  staff   145B Jan  9 12:56 particle.config.json
drwxr-xr-x    7 chipmc  staff   224B Dec  7 15:01 toolchains

Let’s focus on the node_modules line which - to my eye says I have owner permissions to read, write and execute to this directory. However, in the terminal, I see this error:

cmcclell-OSX:~ chipmc$ bash <( curl -sL https://particle.io/install-cli )
Installing the Particle CLI to /Users/chipmc/bin/particle
particle: Installing plugins...
 â–¸    npm WARN checkPermissions Missing write access to /Users/chipmc/.particle/node_modules/particle-cli/node_modules/@babel/core/node_modules/@babel/parser

Am I reading this right?

Thank you for your patience.

Chip

are you sure the CLI doesn’t work?

which particle # should point to ~/.particle/bin
particle version # should return v2.0.1 (as of today)
particle usb list # should NOT return an error about missing dependencies
particle serial inspect # ditto - no error about missing dependencies

if the CLI is still not working, i’m honestly stumped.

@m_m,

I have to admit. The prospect of stumping you is terrifying to me.

So, on your list

cmcclell-OSX:.particle chipmc$ which particle
/Users/chipmc/bin/particle

so, fail on the first line and that is as far as I got. Could that be the issue?

cmcclell-OSX:.particle chipmc$ particle version
particle: Installing plugins...

Thanks, Chip

@m_m,

OK, figured it out.

Turns out that on my system two of the targets you show as hidden were not.

Here are the steps I was following:

delete the following files and directories if available:
.npm-cache
autoupdate
error.log
./node-v8.15.0-<os>-<cpu>
(e.g. node-v8.15.0-windows-x64, node-v8.15.0-darwin-x64, node-v8.15.0-linux-x64)
./node_modules

but, on my system the ./node-v8.15.0 … and the ./node_modules were not hidden and, if I omitted the “.”, I was able to delete them and then the particle update-cli command worked perfectly.

So, to summarize:

All is working now - and no “sudo”!

Thank you

Chip

1 Like

two of the targets you show as hidden were not

the leading ./ was meant to indicate a local directory, not "hidden" - i clarified my post :+1:

@m_m,

My mistake. Happy to illustrate all the ways someone can not correctly follow your instructions. :wink:

Chip

2 Likes