How to set custom haxe libraries path in Project.xml

My project.xml looks like this

<?xml version="1.0" encoding="utf-8"?>
<project>
	
	<meta title="ZealExample" package="com.sample.zealexample" version="1.0.0" company="Company Name" />
	<app main="Main" path="Export" file="ZealExample" />
	<window width="600" height="400" unless="mobile" />
	
	<source path="Source" />
	<source path="../src" />
	
	<haxelib name="openfl" />
	<haxelib name="ZenFlo"/>
	<haxelib name="feathersui"/>
	<haxelib name="hx3Compat"/>
	
	<assets path="Assets" rename="assets" />
	
</project>

But when I try to run openfl test html5 I get this error

Error: Could not find haxelib "ZenFlo", does it need to be installed?

You need to run haxelib install ZenFlo in a terminal to install the library before you can use it in a project.

If you have a custom version of the library checked out on your local hard drive, and you want to use that instead of the version published on Haxelib, you can run the following command in a terminal to tell Haxe the directory where it can to find your custom library:

haxelib dev ZenFlo path/to/ZenFlo

Obviously, replace the path in the command above with the real path from your computer.

Actually, I mean path to haxe libraries directory itself. It is obvious that openfl CLI can’t find mine

Set the directory containing all installed libraries? I doubt that there’s a way to do that specifically for OpenFL. OpenFL relies on Haxe’s native ability to find the libraries, as far as I know.

I think that you can run the haxelib setup command in a terminal to change the directory where libraries are installed for all Haxe projects (not just OpenFL). That’s probably the best you can do.

By the way, if you recently installed a new version of Haxe, that may very well be the cause of your issue. I’ve found that I always need to run haxelib setup at least once every time after I change Haxe versions, because Haxe (and OpenFL) won’t be able to find the libraries until I do.

I have ZenFlo installed via haxelib, so I am confused why it can’t find it. So I had assumed that OpenFL couldn’t locate my haxe libraries directory.

Is there a local .haxelib repository in your project directory? Could it be a case-sensitivity issue?

There’s no .haxelib repo in my directory

From the same directory, try and run haxelib path ZenFlo.

Also try openfl test html5 -v -haxelib-debug

1 Like