添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hello!

Although I had some issues installing the particle CLI at the begining I was happily using it until today. Now when I try to run particle-setup (on Windows 10 cmd), it asks me for my user/pass but then I get a message saying that I need to reinstall particle-cli and the program hangs. I’ve tried to run npm install -g particle-cli as suggested but no luck I was getting this error:

> [email protected] install C:\Users\Dani\AppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport
> prebuild-install || node-gyp rebuild
prebuild-install WARN install No prebuilt binaries found (target=10.15.0 runtime=node arch=x64 platform=win32)
C:\Users\Dani\AppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport>if not defined npm_config_node_gyp (node "C:\Users\Dani\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\Dani\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Command failed: C:\Users\Dani\AppData\Local\Programs\Python\Python37-32\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:294:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Dani\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Dani\AppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dani\AppData\Roaming\npm-cache\_logs\2019-03-01T13_52_12_222Z-debug.log
C:\Users\Dani>particle --version
internal/modules/cjs/loader.js:583
    throw err;
Error: Cannot find module 'C:\Users\Dani\AppData\Roaming\npm\node_modules\particle-cli\bin\particle.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
C:\Users\Dani>npm view particle-cli

I saw that there was an update (1.39.0) pushed a few days ago.
Then I’ve uninstalled particle cli from Windows’ programs and preferences, because npm uninstall particle-cli was not working. Now I try to install it again using npm install -g particle-cli and I’m getting the same error. I searched for this error accross the forum and tried solutions like npm install --unsafe-perm -g particle-cli, manually installing serialport… but nothing helped. Not sure what to do next… I was in a hurry and it failed when I needed it the most. Any help will be welcomed!

You seem to be on Windows so you should not use npm to update or install CLI.
You should rather use the Windows Installer and once installed use particle update-cli to pull in any updates.

To get CLI back you should now uninstall all instances of CLI via npm uninstall particle-cli, npm uninstall -g particle-cli and via Add/Remove Program in Control Panel and remove %localappdata%\particle & %homepath%\.particle.
For being sure also check %appdata%\npm and %appdata%\npm-cache for any particle folder and remove that too.
Then start over with this
https://binaries.particle.io/cli/installer/windows/ParticleCLISetup.exe

You saved my day Sir! I had some issues with the executable when I was installing the CLI for the first time, so that is why I was using npm. However, now I followed all your steps and it worked!

Thank you very much!

One thing that may not be well-known is that when you install the new Workbench IDE, it installs a “local” copy of CLI. Two goodies for the price of one!

Oh wait, they’re free :yum:!