ffmpeg.wasm icon indicating copy to clipboard operation
ffmpeg.wasm copied to clipboard

Cannot find module '@ffmpeg/core'

Open letsfire opened this issue 3 years ago • 12 comments

Describe the bug

INFO Launching Electron... [info] use ffmpeg.wasm v0.9.8 [info] load ffmpeg-core [info] loading ffmpeg-core [info] fetch ffmpeg.wasm-core script from @ffmpeg/core (node:14408) UnhandledPromiseRejectionWarning: Error: Cannot find module '@ffmpeg/core'

Desktop (please complete the following information):

  • OS: [win10]
  • Browser [Electron]
  • Version [11.4.7]

letsfire avatar May 24 '21 07:05 letsfire

@letsfire It's the same problem. Do you use webpack?

ghost avatar Jul 01 '21 09:07 ghost

@r-asada-ab vue-cli-service,it based on webpack ? i lack knowledge about JS. I do not know why,@ffmpeg/core is exist,but cannot find

letsfire avatar Jul 01 '21 09:07 letsfire

I faced a similar issue. After referrring the docs, I found that providing corePath field in the createFFmpeg function solved the issue for me.

   const ffmpeg = createFFmpeg({
        corePath: 'https://unpkg.com/@ffmpeg/[email protected]/dist/ffmpeg-core.js',
        log: true,
    });

nishStoryDigital avatar Jul 05 '21 09:07 nishStoryDigital

Same problem here, running Vue JS on top of electron and trying to load ffmpeg in background. I've tried to change corePath to relative and absolute paths of the ffmpeg-core.js, but the message is always the same:

UnhandledPromiseRejectionWarning: Error: Cannot find module '/path/to/ffmpeg-core.js'

It works perfectly in Vue JS client-side, Electron JS without Vue JS and Node JS.

Did someone else get through that?

gbayarri avatar Nov 14 '22 18:11 gbayarri

Same problem here.

Tried all versions of @ffmpeg/ffmpeg and @ffmpeg/core. Tried it with and without the corePath parameter. Tried with importing from the unpkg URL, tried downloading the assets and using them as static files. In all cases I end up with an error like: Cannot find module '@ffmpeg/core' or Cannot find module '@ffmpeg/core/dist/ffmpeg-core.js'

I suspect the package to be not working for most people because of this.

Details:

  • Using Vite 3.1.0
  • Using the package on the server-side
  • The package works in development mode but not in production mode

clonecorp avatar Nov 26 '22 13:11 clonecorp

I have the same situation as @clonecorp. Whenever I use corePath in the ffmpeg options it can never find the module, even if I've verified the file exists. Using a simple index.js file to instantiate the ffmpeg object, Node v19.1.0.

shn-dev-1 avatar Nov 27 '22 19:11 shn-dev-1

Same. I installed

  "@ffmpeg/ffmpeg": "^0.11.6",
  "@ffmpeg/core": "^0.11.0"

Using createFFmpeg() without corePath results in:

TypeError: fetch failed
    at Object.fetch (node:internal/deps/undici/undici:11413:11)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  cause: Error: unknown scheme

But if I try to provide a corePath i.e

corePath: "https://unpkg.com/@ffmpeg/[email protected]/dist/ffmpeg-core.js",

I get

Error: Cannot find module 'https://unpkg.com/@ffmpeg/[email protected]/dist/ffmpeg-core.js'
Require stack:
- D:\Github\vttc\node_modules\@ffmpeg\ffmpeg\src\node\getCreateFFmpegCore.js
- D:\Github\vttc\node_modules\@ffmpeg\ffmpeg\src\node\index.js
- D:\Github\vttc\node_modules\@ffmpeg\ffmpeg\src\createFFmpeg.js
- D:\Github\vttc\node_modules\@ffmpeg\ffmpeg\src\index.js

phenomen avatar Apr 10 '23 17:04 phenomen

Having the same issue on a next.js project

DerTimonius avatar Apr 27 '23 09:04 DerTimonius

Having the same issue on a next.js project

ranajahanzaib avatar May 19 '23 10:05 ranajahanzaib

Manually installing @ffmpeg/core fixed it for me

npm -i @ffmpeg/core

harshcardealershipguy avatar May 22 '23 22:05 harshcardealershipguy

Same. I tried both with and without core since I wasn't sure why it was needed to be installed if it's not imported like a normal dependency. But it is indeed described to be installed in the README

$ npm install @ffmpeg/ffmpeg @ffmpeg/core

benz2012 avatar May 22 '23 23:05 benz2012

I was able to solve this issue on my express server by downgrading from Node 19 to Node 16. I am using these versions of npm ffmpeg libraries, and not using an external corePath option like some of the other suggestions:

    "@ffmpeg/core": "^0.10.0",
    "@ffmpeg/ffmpeg": "^0.10.0",

shn-dev-1 avatar Aug 21 '23 15:08 shn-dev-1