Skip to content

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

@zhzLuke96

Description

@zhzLuke96

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions