Electron Compile failed: Directory not found!

Hello All,

I’ve been trying to compile my .ino using particle compile electron --target 0.6.4. But it is giving me the error that “SparkJson.h” library not found as shown is SS below:

I have included the library in project.properties. I have the latest CLI version. Please help me solving this issue.

Thanks.

How did you?
What’s the contents of your project.properties?
From where did you run the compile command? (you need to be in the folder where project.properties lives, not where the .ino is)

@ScruffR,
I’ve included it from DEV using “Add to my project” and project.properties is showing dependencies.SparkJson=0.0.1.

Yes, I’ve run the command this way only.

The current version would be 0.0.2 tho’

I’ve also tried that version.

This is what I did and that worked right away

PS C:\Particle\Test> particle project create
What would you like to call your project? [myproject]: TestJSON
Would you like to create your project in the default project directory? [Y/n]: n
Would you like to create your project in C:\Particle\Test? Type “n” to cancel. [Y/n]:
Initializing project in directory C:\Particle\Test\TestJSON...
> A new project has been initialized in directory C:\Particle\Test\TestJSON
PS C:\Particle\Test> cd .\TestJSON\
PS C:\Particle\Test\TestJSON> particle library add sparkjson
> Library SparkJson 0.0.2 has been added to the project.
> To get started using this library, run particle library view SparkJson to view the library documentation and sources
PS C:\Particle\Test\TestJSON> cd .\src\
PS C:\Particle\Test\TestJSON\src> notepad .\TestJSON.ino 
... then I pasted one of the library samples to that file and ...
PS C:\Particle\Test\TestJSON> particle compile electron . --target 0.6.4

Compiling code for electron
Targeting version: 0.6.4

Including:
    src\TestJSON.ino
    project.properties
attempting to compile firmware
downloading binary from: /v1/binaries/5a44e4049cf4665f9b1d04c7
saving to: electron_firmware_1514464248355.bin
Memory use:
   text    data     bss     dec     hex filename
  17500     168    1676   19344    4b90 /workspace/target/workspace.elf

Compile succeeded.
Saved firmware to: C:\Particle\Test\TestJSON\electron_firmware_1514464248355.bin

So the library works for me

My issue seems to be something else!

I’ve tried doing other examples, but every time it shows the same error that library not found! Even tried compiling on photon. Same error again!

What could be the issue? My OS is Windows 10!

EDIT: This is the SS of the code using MDNS library on photon:

If I compare the output of my own attempt and yours I notice that your projects never seem to include project.properties

Including:
    src\TestJSON.ino
    project.properties

I also use this syntax for the build command

paticle compile <platform> . --target <targetVersion>

note the dot between <platform> and --target

It’s probably not a Win 10 issue as I’m also using Win 10.

My test project has this structure

C:\Particle\Test>tree TestJSON /F
C:\PARTICLE\TEST\TESTJSON
│   project.properties
│   README.md
│
└───src
        TestJSON.ino

What does particle --version give you?

1 Like

@ScruffR, what I was doing wrong is I was compiling the project folder. I’ve changed the path and it worked for the MDNS code!

Also, my main project which has “SparkJson.h” and few other libraries. Few of those libraries were private to my team’s particle account and I was logged in my personal account. Now, it is compiled and binary is saved successfully.

Thanks for the help.

1 Like