Skip to content

in NextJs, Error: Cannot find module '@ffprobe-installer/linux-x64/ffprobe' #320

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

Open
zhzLuke96 opened this issue Oct 1, 2024 · 1 comment

Comments

@zhzLuke96
Copy link

zhzLuke96 commented Oct 1, 2024

Background:

I came across issue #274, but it was closed without resolving the problem, so I'm recreate this.

I've managed to resolve this on my own, but I believe it's still important to raise this issue.

Issue:

The error occurs with @ffprobe-installer/linux-x64/ffprobe. In my Next.js project, I am using both @ffprobe-installer and @ffmpeg-installer. However, after running next build, the @ffprobe-installer/linux-x64/ffprobe module is missing (it seems to be optimized out ?). Meanwhile, the similar module @ffmpeg-installer/linux-x64/ffmpeg remains intact.

This issue can be reproduced using the Dockerfile from the Next.js example: https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile

My Solution:

Instead of using the node_modules from the Next.js build result, I copied the node_modules directly from the deps stage.

After lines

https://github.com/vercel/next.js/blob/canary/examples/with-docker/Dockerfile#L56-L58

add:

COPY --from=deps --chown=nextjs:nodejs /app/node_modules ./node_modules
@jincdream
Copy link

+1

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

2 participants