# Steps to use libraries 2.0

**URL:** <https://community.particle.io/t/steps-to-use-libraries-2-0/25354>\
**Category:** Libs 2.0 Beta\
**Created:** [August 25, 2016, 5:39pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354 "2016-08-25T17:39:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 25, 2016, 5:39pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/1 "2016-08-25T17:39:47Z")

</div>

Libraries 2.0 needs support in the CLI and firmware, so follow these steps to get started using it.

1. Install a pre-release version of the CLI  
`npm install -g https://github.com/spark/particle-cli/releases/download/v1.19.0-libraries.23/particle-cli-1.19.0-libraries.23.tgz`

2. Update your device to [0.5.3 firmware](https://github.com/spark/firmware/releases/tag/v0.5.3) or later (on the Photon, you can skip this step and rely on safe mode healer)

3. Create a new folder for your project. The CLI will save the library dependencies in `project.properties`  
`+- application.cpp +- project.properties <-- will be created by the CLI and contain library dependencies`

4. Add a library such as neopixel library as a dependency  
`particle library add neopixel`

5. You should see `Added library neopixel 0.0.10 to project`  
And the line `dependencies.neopixel=0.0.10` should appear in `project.properties`

6. Compile/flash the project using the pre-release firmware  
`particle flash my_photon .`

Please reply to this topic with tool installation issues. If you have other comments and suggestions let’s discuss that in a separate topic.

---

<div class="post-metadata">

**Author:** ![BDub](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bdub/32/5137_2.png) [@BDub](https://community.particle.io/u/BDub)\
**Post date:** [August 26, 2016, 7:18pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/2 "2016-08-26T19:18:06Z")

</div>

On Monday you should also be able to use Libraries 2.0 with v0.5.3-rc.3, and then v0.5.3 (default) at the end of next week.

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [August 27, 2016, 12:03am UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/3 "2016-08-27T00:03:07Z")

</div>

```auto
KENMBP:~ kennethlimcp$ p --version
2.0.0-libraries.2
KENMBP:cli-lib kennethlimcp$ mkdir src
KENMBP:cli-lib kennethlimcp$ cd src/
KENMBP:src kennethlimcp$ touch application.cpp
KENMBP:src kennethlimcp$ ..
KENMBP:cli-lib kennethlimcp$ particle add library neopixel

Usage: library <command>

Commands:
  init Initializes a new library in the specified or current directory..
  install installs a library
  migrate Migrates a local library from v1 to v2 format.
  add Add a library to the current project.

Global Options:
  --args Path to JSON config file
  -v, --verbose How much logging to display [count]
  --interactive forces interactive mode [boolean]
  --non-interactive Run in non-interactive mode. This means all required data
                     must be passed as command line arguments. [boolean]
  --json Output in JSON format instead of human friendly [boolean]
  --help Provides extra details and options for a given command
                                                                       [boolean]

No such command 'library library neopixel'

KENMBP:cli-lib kennethlimcp$ particle compile photon . --target 0.6.0-libraries.1

Compiling code for photon
Targeting version: 0.6.0-libraries.1

Including:
    /Users/kennethlimcp/Desktop/cli-lib/project.properties
    /Users/kennethlimcp/Desktop/cli-lib/src/application.cpp
attempting to compile firmware 
downloading binary from: /v1/binaries/57c0da14f917f2b94bd09094
saving to: photon_firmware_1472256527659.bin
Compile succeeded.
Saved firmware to: /Users/kennethlimcp/Desktop/cli-lib/photon_firmware_1472256527659.bin

```

* * *

The above command should be `particle library add neopixel`

Other than that, things are looking great 😃

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 27, 2016, 12:31am UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/4 "2016-08-27T00:31:12Z")

</div>

I fixed the instructions to say `particle library add neopixel`. Please give it a shot again Kenneth!

---

<div class="post-metadata">

**Author:** ![kennethlimcp](https://avatars.discourse-cdn.com/v4/letter/k/c0e974/32.png) [@kennethlimcp](https://community.particle.io/u/kennethlimcp)\
**Post date:** [August 27, 2016, 1:13am UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/5 "2016-08-27T01:13:18Z")

</div>

I gave it a shot the moment it gave me errors.

It’s working great with an example app. 🍻

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 27, 2016, 1:34am UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/6 "2016-08-27T01:34:38Z")

</div>

I read the terminal output, but misread the comment 😅 Friday night… 🍻 to you too!

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 27, 2016, 2:04pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/7 "2016-08-27T14:04:37Z")

</div>

> [@jvanier](#):
>
> npm install -g [https://github.com/spark/particle-cli/releases/download/v2.0.0-libraries.2/particle-cli-2.0.0-libraries.2.tgz](https://github.com/spark/particle-cli/releases/download/v2.0.0-libraries.2/particle-cli-2.0.0-libraries.2.tgz)

After executing this command on my Win 8.1Pro64bit (no laughing!) I get this

```plaintext
C:\Users\Andy>node --version
v4.2.4

C:\Users\Andy>npm --version
2.14.12

C:\Users\Andy>particle --version
module.js:340
    throw err;
    ^

Error: Cannot find module 'es6-promisify'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\dist\cmd\library_init.js:20:17)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

```

Is there another node update required? Or what else could be wrong?

* * *

That was my output during one of my tries

```plaintext
C:\Users\Andy>npm install -g https://github.com/spark/particle-cli/releases/download/v2.0.0-libraries.2/particle-cli-2.0.0-libraries.2.tgz
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

> spawn-sync@1.0.15 postinstall C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\yeoman-environment\node_modules\inquirer\node
_modules\external-editor\node_modules\spawn-sync
> node postinstall

> spawn-sync@1.0.15 postinstall C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\particle-cli-library-manager\node_modules\yeo
man-generator\node_modules\yeoman-test\node_modules\inquirer\node_modules\external-editor\node_modules\spawn-sync
> node postinstall

-
> serialport@3.1.2 install C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport
> node-pre-gyp install --fallback-to-build

[serialport] Success: "C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\node_modules\serialport\build\Release\serialport.node" is installed
 via remote
C:\Users\Andy\AppData\Roaming\npm\particle -> C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli\bin\particle.js
particle-cli@2.0.0-libraries.2 C:\Users\Andy\AppData\Roaming\npm\node_modules\particle-cli
├── cli-spinner@0.2.5
├── xtend@4.0.1
├── semver@5.3.0
├── chalk@1.1.3 (escape-string-regexp@1.0.5, supports-color@2.0.0, ansi-styles@2.2.1, has-ansi@2.0.0, strip-ansi@3.0.1)
├── temp@0.8.3 (os-tmpdir@1.0.1, rimraf@2.2.8)
├── cli-table@0.3.1 (colors@1.0.3)
├── glob@4.5.3 (inherits@2.0.1, once@1.3.3, inflight@1.0.5, minimatch@2.0.10)
├── node-wifiscanner2@1.2.0 (os-locale@1.4.0)
├── inquirer@0.11.4 (strip-ansi@3.0.1, ansi-regex@2.0.0, ansi-escapes@1.4.0, through@2.3.8, rx-lite@3.1.2, cli-width@1.1.1, figures@1.7.0, string-widt
h@1.0.2, readline2@1.0.1, cli-cursor@1.0.2, run-async@0.1.0)
├── when@3.7.7
├── form-data@1.0.0-rc4 (async@1.5.2, combined-stream@1.0.5, mime-types@2.1.11)
├── binary-version-reader@0.4.0 (buffer-crc32@0.2.5, h5.buffers@0.1.1)
├── latest-version@2.0.0 (package-json@2.4.0)
├── hogan.js@2.0.0
├── request@2.74.0 (aws-sign2@0.6.0, tunnel-agent@0.4.3, forever-agent@0.6.1, oauth-sign@0.8.2, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0
.5, aws4@1.4.1, isstream@0.1.2, json-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.3.1, qs@6.2.1, node-uuid@1.4.7, combined-stream@1.0.5, mime-ty
pes@2.1.11, bl@1.1.2, hawk@3.1.3, http-signature@1.1.1, har-validator@2.0.6)
├── yargs@4.8.1 (get-caller-file@1.0.2, decamelize@1.2.0, lodash.assign@4.2.0, y18n@3.2.1, which-module@1.0.0, set-blocking@2.0.0, require-main-filena
me@1.0.1, require-directory@2.1.1, window-size@0.2.0, yargs-parser@2.4.1, os-locale@1.4.0, cliui@3.2.0, string-width@1.0.2, read-pkg-up@1.0.1)
├── es6-promisify-all@0.1.0 (es6-promisify@2.0.0)
├── handlebars@4.0.5 (async@1.5.2, source-map@0.4.4, optimist@0.6.1, uglify-js@2.7.3)
├── moment@2.14.1
├── particle-api-js@6.0.3 (superagent-prefix@0.0.2, stream-http@2.2.1, superagent@2.2.0)
├── lodash@3.10.1
├── softap-setup@1.1.4 (nconf@0.7.2, node-rsa@0.2.30)
├── yeoman-environment@1.6.3 (escape-string-regexp@1.0.5, log-symbols@1.0.2, text-table@0.2.0, untildify@2.1.0, debug@2.2.0, diff@2.2.3, globby@4.1.0,
 mem-fs@1.1.3, grouped-queue@0.3.2, inquirer@1.1.2, lodash@4.15.0)
├── particle-cli-library-manager@0.0.4-develop.2 (superagent-prefix@0.0.2, babel-plugin-transform-runtime@6.12.0, app-root-path@1.3.0, properties-pars
er@0.3.1, verror@1.8.1, es6-promisify@4.1.0, mkdirp@0.5.1, tar-stream@1.5.2, superagent@1.8.4, gunzip-maybe@1.3.1, fs-extra@0.30.0, particle-api-js@5.
3.0-develop.1, tar.gz@1.0.5, yeoman-generator@0.24.1, async@2.0.1)
├── babel-runtime@6.11.6 (regenerator-runtime@0.9.5, core-js@2.4.1)
└── serialport@3.1.2 (bindings@1.2.1, commander@2.9.0, debug@2.2.0, es6-promise@3.2.1, nan@2.4.0, object.assign@4.0.4)

```

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 27, 2016, 6:29pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/8 "2016-08-27T18:29:00Z")

</div>

> [@ScruffR](#):
>
> Error: Cannot find module 'es6-promisify'

I've seen this particular error while working on the libs 2.0 feature. It's like npm forgets to install one dependency of a dependency (2nd order dependency). I'll add es6-promisify to the main CLI package.json to avoid this.

In the mean time can you try `npm install es6-promisify` from where the CLI module is installed? I'm not sure if this will work given how many folder structures npm has for installed modules...

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 27, 2016, 7:40pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/9 "2016-08-27T19:40:08Z")

</div>

> [@jvanier](#):
>
> npm install es6-promisify

Yup, that solved the problem.  
I installed that package in `%appdata%\npm-cache`

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [August 28, 2016, 12:27pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/10 "2016-08-28T12:27:44Z")

</div>

I just tried to flash a sketch to my Photon via Build with the target set as `0.6.0-libraries.1 (prerelease)` but only ever get _“Error: 500. Please try again later. If the issue persists, please report to [hello@particle.io](mailto:hello@particle.io).”_

I didn’t intend to use the Libraries 2.0 features, but flashing “conventional” firmware should still work, or not?

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 28, 2016, 12:44pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/11 "2016-08-28T12:44:31Z")

</div>

Ok. Thanks for the heads up. I’ll look at that during the week.

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 30, 2016, 2:26pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/12 "2016-08-30T14:26:22Z")

</div>

@ScruffR I created a new prerelease that works on Windows.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 30, 2016, 4:11pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/13 "2016-08-30T16:11:04Z")

</div>

> [@ScruffR](#):
>
> npm install es6-promisify

@jvanier, I just installed on Windows 10 with command line:  
`npm install -g https://github.com/spark/particle-cli/releases/download/v2.0.0-libraries.3/particle-cli-2.0.0-libraries.3.tgz`

I got the same problem with `es6-promisify` not being found. I tried to fix by installing es6-promisify but error remained:

```auto
C:\SPARK\TESTING>npm install es6-promisify
es6-promisify@4.1.0 node_modules\es6-promisify
└── es6-promise@3.2.1

C:\SPARK\TESTING>particle --version
module.js:340
    throw err;
    ^

Error: Cannot find module 'es6-promisify'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:289:25)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at Object.<anonymous> (C:\Users\Paul\AppData\Roaming\npm\node_modules\particle-cli\dist\
cmd\project_properties.js:12:21)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)

C:\SPARK\TESTING>

```

How Is the install command line still correct or did you not publish the new prerelease?

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 30, 2016, 4:12pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/14 "2016-08-30T16:12:42Z")

</div>

Brett just reported the same thing on Node 4. Stay tuned for another update shortly. There’s so much variability when dealing with Node…

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 30, 2016, 4:13pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/15 "2016-08-30T16:13:48Z")

</div>

@jvanier, should I updated to a newer node version? If so, which?

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 30, 2016, 4:21pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/16 "2016-08-30T16:21:40Z")

</div>

It’s best if you just keep using the same version of Node. It’s more representative of what other users will see.

The CLI is supposed to work on Node 4 or later.

When you have a chance you can try the 2.0.0-libraries.4 version that has the es6-promisify fix.

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 30, 2016, 4:30pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/17 "2016-08-30T16:30:22Z")

</div>

@jvanier, FYI here is what the latest install puts out. Running `particle --version` correctl reports `2.0.0-libraries.4`

```auto
C:\SPARK\TESTING>npm install -g https://github.com/spark/particle-cli/releases/download/v2.0
.0-libraries.4/particle-cli-2.0.0-libraries.4.tgz
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
\
> spawn-sync@1.0.15 postinstall C:\Users\Paul\AppData\Roaming\npm\node_modules\particle-cli\
node_modules\yeoman-environment\node_modules\inquirer\node_modules\external-editor\node_modu
les\spawn-sync
> node postinstall

npm WARN excluding symbolic link test\server\static\ie8-polyfill.js -> ../../../ie8-polyfill
.js

> spawn-sync@1.0.15 postinstall C:\Users\Paul\AppData\Roaming\npm\node_modules\particle-cli\
node_modules\particle-cli-library-manager\node_modules\yeoman-generator\node_modules\yeoman-
test\node_modules\inquirer\node_modules\external-editor\node_modules\spawn-sync
> node postinstall

|
> serialport@3.1.2 install C:\Users\Paul\AppData\Roaming\npm\node_modules\particle-cli\node_
modules\serialport
> node-pre-gyp install --fallback-to-build

[serialport] Success: "C:\Users\Paul\AppData\Roaming\npm\node_modules\particle-cli\node_modu
les\serialport\build\Release\serialport.node" is installed via remote
C:\Users\Paul\AppData\Roaming\npm\particle -> C:\Users\Paul\AppData\Roaming\npm\node_modules
\particle-cli\bin\particle.js
particle-cli@2.0.0-libraries.4 C:\Users\Paul\AppData\Roaming\npm\node_modules\particle-cli
├── cli-spinner@0.2.5
├── xtend@4.0.1
├── semver@5.3.0
├── es6-promisify@4.1.0 (es6-promise@3.2.1)
├── temp@0.8.3 (os-tmpdir@1.0.1, rimraf@2.2.8)
├── chalk@1.1.3 (escape-string-regexp@1.0.5, ansi-styles@2.2.1, supports-color@2.0.0, has-an
si@2.0.0, strip-ansi@3.0.1)
├── cli-table@0.3.1 (colors@1.0.3)
├── glob@4.5.3 (inherits@2.0.1, once@1.3.3, inflight@1.0.5, minimatch@2.0.10)
├── node-wifiscanner2@1.2.0 (os-locale@1.4.0)
├── when@3.7.7
├── inquirer@0.11.4 (ansi-regex@2.0.0, strip-ansi@3.0.1, ansi-escapes@1.4.0, rx-lite@3.1.2,
through@2.3.8, cli-width@1.1.1, figures@1.7.0, string-width@1.0.2, readline2@1.0.1, cli-curs
or@1.0.2, run-async@0.1.0)
├── form-data@1.0.0-rc4 (async@1.5.2, combined-stream@1.0.5, mime-types@2.1.11)
├── binary-version-reader@0.4.0 (buffer-crc32@0.2.5, h5.buffers@0.1.1)
├── latest-version@2.0.0 (package-json@2.4.0)
├── hogan.js@2.0.0
├── request@2.74.0 (tunnel-agent@0.4.3, aws-sign2@0.6.0, oauth-sign@0.8.2, forever-agent@0.6
.1, is-typedarray@1.0.0, caseless@0.11.0, stringstream@0.0.5, aws4@1.4.1, isstream@0.1.2, js
on-stringify-safe@5.0.1, extend@3.0.0, tough-cookie@2.3.1, qs@6.2.1, node-uuid@1.4.7, combin
ed-stream@1.0.5, mime-types@2.1.11, bl@1.1.2, hawk@3.1.3, http-signature@1.1.1, har-validato
r@2.0.6)
├── yargs@4.8.1 (get-caller-file@1.0.2, decamelize@1.2.0, lodash.assign@4.2.0, y18n@3.2.1, w
hich-module@1.0.0, set-blocking@2.0.0, require-main-filename@1.0.1, require-directory@2.1.1,
 window-size@0.2.0, yargs-parser@2.4.1, os-locale@1.4.0, string-width@1.0.2, cliui@3.2.0, re
ad-pkg-up@1.0.1)
├── particle-api-js@6.0.4 (superagent-prefix@0.0.2, stream-http@2.2.1, superagent@2.2.0)
├── handlebars@4.0.5 (async@1.5.2, source-map@0.4.4, optimist@0.6.1, uglify-js@2.7.3)
├── moment@2.14.1
├── lodash@3.10.1
├── softap-setup@1.1.4 (nconf@0.7.2, node-rsa@0.2.30)
├── yeoman-environment@1.6.3 (escape-string-regexp@1.0.5, log-symbols@1.0.2, text-table@0.2.
0, untildify@2.1.0, debug@2.2.0, diff@2.2.3, globby@4.1.0, mem-fs@1.1.3, grouped-queue@0.3.2
, inquirer@1.1.2, lodash@4.15.0)
├── particle-cli-library-manager@0.0.4-develop.3 (superagent-prefix@0.0.2, babel-plugin-tran
sform-runtime@6.12.0, app-root-path@1.3.0, properties-parser@0.3.1, verror@1.8.1, mkdirp@0.5
.1, tar-stream@1.5.2, superagent@1.8.4, gunzip-maybe@1.3.1, fs-extra@0.30.0, tar.gz@1.0.5, y
eoman-generator@0.24.1, async@2.0.1)
├── babel-runtime@6.11.6 (regenerator-runtime@0.9.5, core-js@2.4.1)
└── serialport@3.1.2 (bindings@1.2.1, es6-promise@3.2.1, commander@2.9.0, nan@2.4.0, object.
assign@4.0.4, debug@2.2.0)

C:\SPARK\TESTING>

```

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 30, 2016, 5:00pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/18 "2016-08-30T17:00:23Z")

</div>

@jvanier, I created an app directory under which I added an `src` directory. I imported the neopixel library (since I couldn’t import any other!) and used one of the examples files and placed it in the src directory (rainbow.cpp). When I compile (not flash) from the app directory I get:

```auto
C:\SPARK\TESTING\libtest>particle compile photon . --target 0.6.0-libraries.1

Compiling code for photon
Targeting version: 0.6.0-libraries.1

Including:
    C:/SPARK/TESTING/libtest/project.properties
    C:/SPARK/TESTING/libtest/src/rainbow.cpp
attempting to compile firmware
Compile failed. Exiting.
Now using node v0.10.44
Processing /workspace/project.properties
Skipping .properties file
Processing /workspace/rainbow.cpp
Skipping .cpp file
Now using node v6.2.1
particle-cli v1.16.0-develop.1

! A newer version (1.16.0) of particle-cli is available.
! Upgrade now by running: npm install -g particle-cli

particle-cli v1.16.0-develop.1

! A newer version (1.16.0) of particle-cli is available.
! Upgrade now by running: npm install -g particle-cli

Cannot install library: directory '/workspace' is a 'simple' format project, please change t
o a 'extended' format.
fatal: repository '/firmware' does not exist
make -C ../modules/photon/user-part all
make[1]: Entering directory '/firmware/modules/photon/user-part'
make -C ../../../user
make[2]: Entering directory '/firmware/user'
Building cpp file: /workspace/rainbow.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-6-m/workspace/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFO
RM_NAME=photon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -DSPARK_P
LATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=6 -DPROD
UCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING
=0.6.0-rc.1 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../c
ommunication/src -I../hal/inc -I../hal/shared -I../hal/src/photon -I../hal/src/stm32f2xx -I.
./hal/src/stm32 -I../hal/src/photon/api -I../platform/shared/inc -I../platform/MCU/STM32F2xx
/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../platfor
m/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driv
er/inc -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/
inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/In
clude -I../dynalib/inc -I/workspace/ -I./libraries -I. -MD -MP -MF ../build/target/user/plat
form-6-m/workspace/rainbow.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-er
ror=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -
DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLAT
FORM_NET=BCM9WCDUSI09 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc -DLOG_INCL
UDE_SOURCE_INFO -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x80A0000
-DMODULAR_FIRMWARE=1 -DMODULE_VERSION=4 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPEND
ENCY=4,2,100 -D_GNU_SOURCE -D_WINSOCK_H -DLOG_MODULE_CATEGORY="\"app\"" -fno-exceptions -fn
o-rtti -fcheck-new -std=gnu++11 -c -o ../build/target/user/platform-6-m/workspace/rainbow.o
/workspace/rainbow.cpp
/workspace/rainbow.cpp:9:52: fatal error: neopixel/neopixel.h: No such file or directory
 #include "neopixel/neopixel.h" // use for Build IDE
                                                    ^
compilation terminated.
../build/module.mk:261: recipe for target '../build/target/user/platform-6-m/workspace/rainb
ow.o' failed
make[2]: *** [../build/target/user/platform-6-m/workspace/rainbow.o] Error 1
make[2]: Leaving directory '/firmware/user'
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: *** [user] Error 2
make[1]: Leaving directory '/firmware/modules/photon/user-part'
../build/recurse.mk:11: recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

C:\SPARK\TESTING\libtest>

```

---

<div class="post-metadata">

**Author:** ![peekay123](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/peekay123/32/810_2.png) [@peekay123](https://community.particle.io/u/peekay123)\
**Post date:** [August 30, 2016, 5:08pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/19 "2016-08-30T17:08:27Z")

</div>

@jvanier, the reason I could not add other libraries is that the upper/lower case letters in the library name need to match exactly with the library’s name. Since the libraries are listed in all-caps, you need to get the correct spelling by viewing the “i” information for that library. This makes the process painful.

---

<div class="post-metadata">

**Author:** ![jvanier](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/jvanier/32/5542_2.png) [@jvanier](https://community.particle.io/u/jvanier)\
**Post date:** [August 30, 2016, 5:12pm UTC](https://community.particle.io/t/steps-to-use-libraries-2-0/25354/20 "2016-08-30T17:12:02Z")

</div>

We are still missing the compatibility layer in the compile server to make the old style `#include "neopixel/neopixel.h"` work. For now you can have to use `#include "neopixel.h"` directly, à la Arduino.

You can now use any public library, not just neopixel anymore.

What’s worrying me is that the project structure is being flattened. The log show `Building cpp file: /workspace/rainbow.cpp` instead of `Building cpp file: /workspace/src/rainbow.cpp`

**Due to the project being flattened, it’s not possible to compile projects with libraries on Windows.**

We’ll make the library name case insensitive.

[Next page](https://community.particle.io/t/steps-to-use-libraries-2-0/25354.md?page=2)
