Particle CLI - particle library init not found

after updating particle-cli, my CLI is now at version 3.10.10… it was updated as global and using sudo

I’m getting error:

No such command 'library init'

I can create projects… just not libraries.

anyone else have a problem using init with the new libraries CLI tool?

That's rather surprising :confused:
AFAIK the most recent version is 1.19.2

And isn't it particle library create <libName>?


C:\Users>particle library --help
Usage: library <command>

Commands:
  add      Adds a library to the current project
  create   Creates a new library in the specified or current directory
  copy     Copies a library to the current project
  view     View details about a library
  list     Lists libraries available
  migrate  Migrates a local library from v1 to v2 format
  search   Searches available libraries
  upload   Uploads a private version of a library
  publish  Publishes a private library, making it public

Global Options:
  -v, --verbose  Increases how much logging to display                   [count]
  -q, --quiet    Decreases how much logging to display                   [count]
1 Like

sorry, wrong paste... that was my npm version (I checked that too).

/usr/local/lib
└── particle-cli@1.19.2 

I was referring to Step 2. of the uber library example on github.

Similar issues using create but slightly different error:

A name parameter is required to create a storage

the particle library list command works, returning my libraries as well as those published:

results:

My Libraries
DailyTimerSpark 0.1.3 38 Library that allow you to create daily timers
LiquidCrystal_I2C_Spark 1.1.0 816 LiquidCrystal_I2C ported for Spark Core
Sunrise 0.1.7 44 Sunrise/Sunset Time ported for Spark Core

Community Libraries
InternetButton 0.1.11 [official] 7660 Functions to make the Internet Button easy to use! If you have an original SparkButton, make sure to use begin(1)
AssetTracker 0.0.5 [official] 1196 Functions to make the Asset Tracker for Electron easy to use!
RelayShield 0.0.6 [official] 783 Functions to make the Photon Relay Shield even easier!
PowerShield 0.0.5 [official] 576 Library to support the fuel guage on the Power Shield
MakerKit 1.2.0 [official] 66 A library with examples for each Particle Maker Kit tutorial.
neopixel 0.0.13 [verified] 9125 An Implementation of Adafruit's NeoPixel Library for the Spark Core, Particle Photon, P1, Electron and RedBear Duo
OneWire 2.0.1 [verified] 5003 Dallas 1-Wire protocol with support for DS18B20, DS1820, DS1822
Serial_LCD_SparkFun 0.0.1 [verified] 285 A port of the serLCD library for the 16x2 LCD. Connect the LCD's RX to the Particle's TX, and print to Serial1
blynk 0.4.5 6182 Build a smartphone app for your project in minutes!
HttpClient 0.0.5 5280 A work in progress Http Client Library for the Spark Core and Arduino.
Press ENTER for next page, CTRL-C to exit.

My bad.
The <libName> either needs a --name before or CLI will ask for it.

1 Like

Indeed, you are correct sir. I tried a bunch of variants of that, exactly.

No such command 'library init'
JimMacbookPro:testlib james$ particle library --name test1 create
A name parameter is required to create a storage
JimMacbookPro:testlib james$ particle library create --name testing
A name parameter is required to create a storage
JimMacbookPro:testlib james$

Below is the help for library create, but in a nutshell, if you only specify particle(-cli) library create, it should ask you for the library name, version and author. If you provide those parameters like particle library create --name dummyLibrary --version 1.0.0 --author dummyAuthor then it should create the template files for the library in the current directory.

If it doesn’t do that… then something is broken somewhere! :open_mouth:

This is what it looks like on my windows box running v1.19.2 of the particle cli. I’m running node.js 6.9.5 if that matters.

Usage: library create [options]

Global Options:
  -v, --verbose  Increases how much logging to display                   [count]
  -q, --quiet    Decreases how much logging to display                   [count]

Options:
  --name     The name of the library to create.
  --version  The initial version of the library to create.
  --author   The author of the library.
1 Like

Seriously broken... yes.

$ particle library create
A name parameter is required to create a storage

I guess someone is going to tell me to do a reinstall, next.

Anyone else capable of doing this on a Mac before I go through all that?

So, i uninstalled/reinstalled particle-cli.... no success.

anyone have any recommendations? Again, I am on a mac here.

I am getting an error regarding the minimatch module:

$ sudo npm install -g particle-cli
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN excluding symbolic link test/server/static/ie8-polyfill.js -> ../../../ie8-polyfill.js
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
/usr/local/bin/particle -> /usr/local/lib/node_modules/particle-cli/bin/particle.js
/usr/local/lib
└── particle-cli@1.19.2

JimMacbookPro:testlib james$ sudo npm list minimatch
/Users/james
└── (empty)

npm ERR! code 1
JimMacbookPro:testlib james$

Odd. I got basically the same output as pfeerick when I tried it on the Mac:

$ mkdir testlib
$ cd testlib/
$ particle library create
? Enter a name for your library: testlib
? Enter a version for your library: 0.0.1
? Who is the author of your library: rickkas7@rickkas7.com
   create library.properties
   create README.md
   create LICENSE
   create src/testlib.cpp
   create src/testlib.h
   create examples/usage/usage.ino
$ particle --version
1.19.2

hmmmm… do you also get the deprecation warning for minimatch when updating particle-cli?

Maybe I have some conflicting dependancies in npm. It looks like particle-cli has dependancies with different versions of minimatch. Then again, maybe none of this matters!

Can you npm list -g minimatch for me?

> 08:18:23 $ npm list -g minimatch
/usr/local/lib
├─┬ ionic@2.0.0
│ ├─┬ gulp@3.8.8
│ │ ├─┬ liftoff@0.12.1
│ │ │ └─┬ findup-sync@0.1.3
│ │ │   └─┬ glob@3.2.11
│ │ │     └── minimatch@0.3.0 
│ │ └─┬ vinyl-fs@0.3.14
│ │   ├─┬ glob-stream@3.1.18
│ │   │ └── minimatch@2.0.10 
│ │   └─┬ glob-watcher@0.0.6
│ │     └─┬ gaze@0.5.2
│ │       └─┬ globule@0.1.0
│ │         └── minimatch@0.2.14 
│ ├─┬ prompt@0.2.12
│ │ └─┬ utile@0.2.1
│ │   └─┬ rimraf@2.5.4
│ │     └─┬ glob@7.0.5
│ │       └── minimatch@3.0.3 
│ └─┬ unzip@0.1.9
│   └─┬ fstream@0.1.31
│     └─┬ rimraf@2.5.4
│       └─┬ glob@7.0.5
│         └── minimatch@3.0.3 
├── minimatch@3.0.3 
├─┬ npm@3.10.10
│ ├─┬ fstream-npm@1.2.0
│ │ └─┬ fstream-ignore@1.0.5
│ │   └── minimatch@3.0.3 
│ ├─┬ glob@7.1.0
│ │ └── minimatch@3.0.3 
│ ├─┬ init-package-json@1.9.4
│ │ └─┬ glob@6.0.4
│ │   └── minimatch@3.0.3 
│ ├─┬ node-gyp@3.4.0
│ │ └── minimatch@3.0.3 
│ └─┬ read-package-json@2.0.4
│   └─┬ glob@6.0.4
│     └── minimatch@3.0.3 
├─┬ particle-cli@1.19.2
│ ├─┬ glob@4.5.3
│ │ └── minimatch@2.0.10 
│ ├─┬ serialport@4.0.7
│ │ └─┬ node-pre-gyp@0.6.32
│ │   ├─┬ rimraf@2.5.4
│ │   │ └─┬ glob@7.1.1
│ │   │   └── minimatch@3.0.3 
│ │   └─┬ tar-pack@3.3.0
│ │     └─┬ fstream-ignore@1.0.5
│ │       └── minimatch@3.0.3 
│ └─┬ yeoman-generator@0.24.1
│   ├─┬ glob@7.1.1
│   │ └── minimatch@3.0.3 
│   ├─┬ mem-fs-editor@2.3.0
│   │ ├─┬ glob@7.1.1
│   │ │ └── minimatch@3.0.3 
│   │ └─┬ multimatch@2.1.0
│   │   └── minimatch@3.0.3 
│   ├─┬ rimraf@2.5.4
│   │ └─┬ glob@7.1.1
│   │   └── minimatch@3.0.3 
│   └─┬ shelljs@0.7.6
│     └─┬ glob@7.1.1
│       └── minimatch@3.0.3 
└─┬ reverse-proxy-js@0.5.4
  └─┬ forever@0.15.2
    ├─┬ forever-monitor@1.6.0
    │ ├─┬ chokidar@1.6.0
    │ │ ├─┬ fsevents@1.0.14
    │ │ │ └─┬ node-pre-gyp@0.6.29
    │ │ │   └─┬ rimraf@2.5.3
    │ │ │     └─┬ glob@7.0.5
    │ │ │       └── minimatch@3.0.2 
    │ │ └─┬ readdirp@2.1.0
    │ │   └── minimatch@3.0.2 
    │ └── minimatch@2.0.10 
    └─┬ utile@0.2.1
      └─┬ rimraf@2.5.4
        └─┬ glob@7.0.5
          └── minimatch@3.0.2 

my try as you did above:

> 08:12:08 $ mkdir testlib
> 08:12:41 $ cd testlib/
> 08:12:50 $ particle library create
A name parameter is required to create a storage
> 08:13:02 $ 

Everyone gets the minimatch warning; that shouldn’t be a problem. Your CLI is otherwise working, like you can do particle list and things like that, right?

yeah, it works fine, even with the project create tool:

> 08:33:00 $ particle library create
A name parameter is required to create a storage
> 08:33:05 $ 
> 08:33:07 $ particle project create
What would you like to call your project? [myproject]: my-proj
Would you like to create your project in the default project directory? [Y/n]: > 08:33:32 $ 
> 08:33:34 $ 
> 08:33:51 $ particle library create --name my-test-lib
A name parameter is required to create a storage
> 08:34:07 $ 
> 08:34:10 $ 

verbose error log:

> 09:00:32 $ particle library create -v
A name parameter is required to create a storage
{ AssertionError: A name parameter is required to create a storage
    at new Storage (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-generator/lib/util/storage.js:24:3)
    at LibraryInitGenerator.Base._getStorage (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-generator/lib/base.js:673:10)
    at LibraryInitGenerator.Base (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-generator/lib/base.js:157:22)
    at LibraryInitGenerator._class (/usr/local/lib/node_modules/particle-cli/node_modules/particle-library-manager/dist/libinit.js:91:108)
    at new LibraryInitGenerator (/usr/local/lib/node_modules/particle-cli/node_modules/particle-library-manager/dist/libinit.js:299:143)
    at Environment.instantiate (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-environment/lib/environment.js:336:10)
    at Environment.create (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-environment/lib/environment.js:313:15)
    at Environment.run (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-environment/lib/environment.js:372:24)
    at /usr/local/lib/node_modules/particle-cli/node_modules/particle-commands/dist/cmd/library_init.js:97:20
    at /usr/local/lib/node_modules/particle-cli/node_modules/es6-promisify/dist/promisify.js:75:41
  name: 'AssertionError',
  actual: '',
  expected: true,
  operator: '==',
  message: 'A name parameter is required to create a storage',
  generatedMessage: false } [ 'AssertionError: A name parameter is required to create a storage',
  '    at new Storage (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-generator/lib/util/storage.js:24:3)',
  '    at LibraryInitGenerator.Base._getStorage (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-generator/lib/base.js:673:10)',
  '    at LibraryInitGenerator.Base (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-generator/lib/base.js:157:22)',
  '    at LibraryInitGenerator._class (/usr/local/lib/node_modules/particle-cli/node_modules/particle-library-manager/dist/libinit.js:91:108)',
  '    at new LibraryInitGenerator (/usr/local/lib/node_modules/particle-cli/node_modules/particle-library-manager/dist/libinit.js:299:143)',
  '    at Environment.instantiate (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-environment/lib/environment.js:336:10)',
  '    at Environment.create (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-environment/lib/environment.js:313:15)',
  '    at Environment.run (/usr/local/lib/node_modules/particle-cli/node_modules/yeoman-environment/lib/environment.js:372:24)',
  '    at /usr/local/lib/node_modules/particle-cli/node_modules/particle-commands/dist/cmd/library_init.js:97:20',
  '    at /usr/local/lib/node_modules/particle-cli/node_modules/es6-promisify/dist/promisify.js:75:41' ]
> 09:00:40 $ 

@rickkas7

any advice here?

@kennethlimcp ? @Moors7 ?

any suggestions here?

@BulldogLowell i wonder if it’s an issue for your specific linux distribution. Can you share more information?

I get this:

KENMBP:lib kennethlimcp$ p library create
? Enter a name for your library: kennethlimcp
? Enter a version for your library: 0.0.1
? Who is the author of your library: me!
   create library.properties
   create README.md
   create LICENSE
   create src/kennethlimcp.cpp
   create src/kennethlimcp.h
   create examples/usage/usage.ino

@kennethlimcp He’s on a Mac :open_mouth: But yes, some more details like the version might be handy :wink:

macOS Sierra 10.12.3

/usr/local/lib
└── particle-cli@1.19.2

dev: 1.7.4

I’ve uninstalled and reinstalled, etc…

@BulldogLowell, i wonder if particle-cli is unable to create the files in the directory that you are in.

Did you:

$ mkdir testlib (in the desktop)
$ cd test lib
$ particle library create

well,
project create works.... but library create... nope.

19:39:30Mon Feb 06 $ mkdir testlib
19:39:43Mon Feb 06 $ cd testlib/
19:39:49Mon Feb 06 $ particle library create
A name parameter is required to create a storage
19:40:02Mon Feb 06 $