itsKaynine / comfy-ui-client

Node.js WebSockets API client for ComfyUI
MIT License
79 stars 30 forks source link

SyntaxError: Cannot use import statement outside a module #4

Open Kacey-Tay opened 5 months ago

Kacey-Tay commented 5 months ago

Not sure why this is happening, using the examples..

import { v4 as uuidv4 } from 'uuid';

import { ComfyUIClient } from 'comfy-ui-client'; import type { Prompt } from 'comfy-ui-client';

// The ComfyUI server address const SERVER_ADDRESS = '127.0.0.1:8188';

export const txt2img = async ( prompt: Prompt, outputDir: string, ): Promise => { // Create client ID const clientId = uuidv4();

// Create client const client = new ComfyUIClient(SERVER_ADDRESS, clientId);

// Connect to server await client.connect();

// Get images const images = await client.getImages(prompt);

// Save images to file await client.saveImages(images, outputDir);

// Disconnect await client.disconnect(); };

melMass commented 5 months ago

This is a full working demo around the code you provided. It's not an issue with this library. client_demo.zip