[ISSUE] Failed to import project - `./lib` folder exists!

photon
Tags: #<Tag:0x00007fe226558268>

#1

I’m starting with Particle Workbench and I want to import an existing project but all I can get from the VS Code is an error message: Failed to import project and the source is: Workbench Core (Extension).

When I check the logs messages this is the output:

Directory `./lib` exists! cannot install libraries.

Error: Directory `./lib` exists! cannot install libraries.

at throwIfTrue (C:\Users\AIOTIK-005\.vscode\extensions\particle.particle-vscode-core-1.4.4\src\cli\index.js:251:9)

at _checkCanInstallLibraries.directoryExists.then (C:\Users\AIOTIK-005\.vscode\extensions\particle.particle-vscode-core-1.4.4\src\cli\index.js:90:75)

- - - -

I also tried opening the existing project into VS Code but I am getting the same results, this is my directory:

$ ls
.vscode/  lib/  project.properties  README.md  src/  target/

Is there something that I’m missing right now? Is there other procedure that I need to follow?

Any comment will be helpful, thanks!


#2

Can you elaborate how exactly you are importing the project and from where and where to?


#3

Well what I did was to:

  1. open VS Code without any workspace opened
  2. go to the Particle Workbench tool
  3. open the Command Palette and look for Particle: Import Project
  4. go to my project directory in this location C:\Users\user_ID\embedded_systems\particle\photon\project_directory_here
  5. Look for the project.properties project
  6. Click to open project.properties

And this is where I am getting this Failed to Import Project error.

,


#4

If the directory you are importing already has a lib folder you’ll get this error. Rename the lib folder to say “lib-old” and see if it will import.

Also, make sure you are logged into your particle account.

I was experiencing this when I was setting up my Github repositories.

Might be something different though…


#5

Hey! That was the problem!

I rename the file like you suggest and the project was able to be imported succesfully! That file was created because I cloned a repo with that file too, looks like for future usage, we should ignore the lib folder created to make easier for developers to reproduce easily a selected repository.

And yes I also verified that I was logged with my particle account. :slight_smile:


#6

@kenco Great advise. I too observed the same “import project” error as @fabocode. In addition to temporarily renaming the existing LIB folder of the project being imported, I also had to temporally delete the library file reference in the project.properties folder of the project being imported. Now Workbench is able to import and compile the imported code.


#7

After recently reading multiple reports of that, I think that this might be a “new” task for @m_m :wink:


#8

upon importing, we try to install the libraries referenced in your project.properties file locally but as you’ve observed bail out if ./lib already exists. this is to ensure we don’t stomp on any of your files.

looks like for future usage, we should ignore the lib folder

here’s a previous discussion w/ some pointers:

we should probably auto-generate a boilerplate .gitignore file or at least call it out in the docs - sorry about that :pray:

In addition to temporarily renaming the existing LIB folder of the project being imported, I also had to temporally delete the library file reference in the project.properties

:thinking: why? did you just want to avoid installing those libs locally? without them local compilation will fail (but cloud compilation will succeed assuming you replaced the lines in project.properties or were not actually using those libs in your code).

After recently reading multiple reports of that, I think that this might be a “new” task

:+1: what behavior would you all prefer? prompt to “replace ./lib?” if it’s detected during an import? more helpful error messaging? other?


#9

I’d think hanging that up on ./lib is to broad. Each and every library in that directory has (usually) got its own subdirectory and there is no risk in overwriting files that only exist in one of the two (source vs. target). So a merge should be possible.

Additionally when a conflict is detected a dialog to select which to take (source/target) would be good.


#10

Additionally when a conflict is detected a dialog to select which to take (source/target) would be good.

I agree with @ScruffR, most of it is just to be as clear as possible regarding with issue should be cleared to make the particle workbench to work.