elevenlabs / elevenlabs-js

The official JavaScript (Node) library for ElevenLabs Text to Speech.
https://elevenlabs.io
MIT License
60 stars 7 forks source link

Elevenlabs npm package does not work on Vercel Edge runtime #43

Closed OwaisSiddiqui closed 2 weeks ago

OwaisSiddiqui commented 1 month ago

Hello. I am trying to use the elevenlabs npm package in a actions.ts file within a Next.js app router app. When I use a runtime config like

export const runtime = 'edge'

within a layout.ts file, it causes the error:

Module not found: Can't resolve 'child_process'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./node_modules/command-exists/index.js
./node_modules/elevenlabs/wrapper/play.js
./node_modules/elevenlabs/wrapper/index.js
./node_modules/elevenlabs/index.js
./src/app/(chat)/actions.ts
./src/components/chat.tsx

from the actions.ts file.

Is it possible to fix this error?

dsinghvi commented 2 weeks ago

Hey -- @OwaisSiddiqui we just released version 0.8.0 that should work on Vercel Edge Runtime. Note that you'll need to install the stream package manually in your Next.js app, but other than that things should work.

Please feel free to open up this issue if the latest version doesn't work. Sorry for any inconvenience!