CLI image training error - What can I do?

Issue:
Hello,
I seem to be having problems getting the image training via the CLI to work.
I installed the CLI just as described in the documentation with:

npm i -g @zappar/zapworks-cli

I can run commands like zapworks serve and it works as expected. However, when running zapworks train anyImage.jpg I get the following error.

Training the image - this may take a few moments...
TypeError: Failed to parse URL from /usr/lib/node_modules/@zappar/zapworks-cli/node_modules/@zappar/imagetraining/lib/ImageTraining.wasm
/usr/lib/node_modules/@zappar/zapworks-cli/node_modules/@zappar/imagetraining/lib/ImageTraining_node.js:48
                throw ex;
                ^

RuntimeError: abort(TypeError: Failed to parse URL from /usr/lib/node_modules/@zappar/zapworks-cli/node_modules/@zappar/imagetraining/lib/ImageTraining.wasm). Build with -s ASSERTIONS=1 for more info.
    at process.abort (/usr/lib/node_modules/@zappar/zapworks-cli/node_modules/@zappar/imagetraining/lib/ImageTraining_node.js:288:145)
    at process.emit (node:events:513:28)
    at emit (node:internal/process/promises:150:20)
    at processPromiseRejections (node:internal/process/promises:284:27)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:32)

Node.js v19.1.0

I also tried the beta version with the same result.
What am I missing to make this work? The documentation seems pretty straight forward and I couldn’t find anything on this forum about this either, but two of my devices (Linux and MacOS) are having the same issue.

Thank you for your help.

2 Likes

I am getting the same Error. Node.js 18.12.1 on Ubuntu.

1 Like

Same here, cant train anything

Hi. Anyone who is having this issue - try downgrading your version of Node (great guide here: How to change your node version using Homebrew - Denis Bouquet) to Node 16.

Hi everybody!

Thanks so much for highlighting this. I just wanted to confirm that for now, @Jon has the best workaround if you intend to use the ZapWorks CLI - please continue to use Node v16.

I’ve brought this to the development teams, and there is now an internal task.

In the meantime, if you cannot downgrade your version of Node, another option is to train your target images with ZapWorks Studio. There’s information on how to do this on our documentation.

Once trained, you can right click on the resulting .zpt in the Media Library and export it to your chosen destination on your device.

Have a great day!
Francesca :blush: