Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile failed when I use hook only #111

Open
zkhCreator opened this issue Dec 18, 2023 · 3 comments
Open

compile failed when I use hook only #111

zkhCreator opened this issue Dec 18, 2023 · 3 comments
Assignees

Comments

@zkhCreator
Copy link

Describe the bug
when I use useAudioRecorder only, it shows failed to load ffmpeg core.
but when I use hook and UI Components, it shows ok. how to solve it?

My Project based on NextJS 14.

here is my stack:

yarn run v1.22.21
$ next dev
   ▲ Next.js 14.0.4
   - Local:        http://localhost:3000

 ✓ Ready in 3.5s
 ○ Compiling /chat/[type] ...
 ⨯ ./node_modules/@ffmpeg/ffmpeg/src/browser/defaultOptions.js:7:0
Module not found: Can't resolve '/node_modules/@ffmpeg/core/dist/ffmpeg-core.js'

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

Import trace for requested module:
./node_modules/@ffmpeg/ffmpeg/src/browser/index.js
./node_modules/@ffmpeg/ffmpeg/src/index.js
./app/(page)/chat/hooks/useAudio.tsx
./app/(page)/chat/_component/audio-chat/audio-chat.tsx
 ⨯ ./node_modules/@ffmpeg/ffmpeg/src/browser/defaultOptions.js:7:0
Module not found: Can't resolve '/node_modules/@ffmpeg/core/dist/ffmpeg-core.js'

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

Import trace for requested module:
./node_modules/@ffmpeg/ffmpeg/src/browser/index.js
./node_modules/@ffmpeg/ffmpeg/src/index.js
./app/(page)/chat/hooks/useAudio.tsx
./app/(page)/chat/_component/audio-chat/audio-chat.tsx
 ⨯ ./node_modules/@ffmpeg/ffmpeg/src/browser/defaultOptions.js:7:0
Module not found: Can't resolve '/node_modules/@ffmpeg/core/dist/ffmpeg-core.js'

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

Import trace for requested module:
./node_modules/@ffmpeg/ffmpeg/src/browser/index.js
./node_modules/@ffmpeg/ffmpeg/src/index.js
./app/(page)/chat/hooks/useAudio.tsx
./app/(page)/chat/_component/audio-chat/audio-chat.tsx
 ⚠ Fast Refresh had to perform a full reload due to a runtime error.
 ✓ Compiled /favicon.ico in 161ms (485 modules)

To Reproduce
Steps to reproduce the behavior:

Expected behavior
run success.

Screenshots
image

Package info (please complete the following information):

  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@zkhCreator
Copy link
Author

maybe the reason is that I use the hook in my hook. maybe my hook will compile in the server(because nextjs default render in server side). it cause the problem. but I dont know how to fix it. I explore all of the hook in my components.

@tsensei
Copy link

tsensei commented Jan 23, 2024

@zkhCreator Did you find any solution?

@zkhCreator
Copy link
Author

@tsensei I just use the hooks in my client component directly, just use it in the use client tsx file. I think the client component not compile on the server side, so it will not show the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants