PS C:\Users\CyberSpace\Desktop\tkFinall> node 5_compose_tiktok_video.mjs
file:///C:/Users/CyberSpace/Desktop/tkFinall/5_compose_tiktok_video.mjs:6
import glob from "glob";
^^^^
SyntaxError: The requested module 'glob' does not provide an export named 'default'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:578:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
TypeError: createFFmpeg is not a function
at file:///C:/Users/CyberSpace/Desktop/tkFinall/5_compose_tiktok_video.mjs:10:16
at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:578:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
means your import for createFFmpeg either failed or did not bring in what you expected.
Why does this happen?
Usually createFFmpeg is imported from the @ffmpeg/ffmpeg package, like this:
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';
If the import statement is wrong or the installed package is outdated/misconfigured, createFFmpeg could be undefined.
What to do?
Check your import statement
User
it failes my test PS C:\Users\CyberSpace\Desktop\tkFinall> node test_ffmpeg.mjs
file:///C:/Users/CyberSpace/Desktop/tkFinall/test_ffmpeg.mjs:1
import { createFFmpeg } from '@ffmpeg/ffmpeg';
^^^^^^^^^^^^
SyntaxError: The requested module '@ffmpeg/ffmpeg' does not provide an export named 'createFFmpeg'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:180:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:263:5)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:578:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
ReferenceError: ffmpegModule is not defined
at file:///C:/Users/CyberSpace/Desktop/tkFinall/test_ffmpeg.mjs:1:26
at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:578:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
Module: null prototype] { FFmpeg: [class FFmpeg] }
undefined
PS C:\Users\CyberSpace\Desktop\tkFinall> node test_ffmpeg.mjs
function
file:///C:/Users/CyberSpace/Desktop/tkFinall/node_modules/@ffmpeg/ffmpeg/dist/esm/empty.mjs:4
throw new Error("ffmpeg.wasm does not support nodejs");
^
Error: ffmpeg.wasm does not support nodejs
at new FFmpeg (file:///C:/Users/CyberSpace/Desktop/tkFinall/node_modules/@ffmpeg/ffmpeg/dist/esm/empty.mjs:4:15)
at file:///C:/Users/CyberSpace/Desktop/tkFinall/test_ffmpeg.mjs:7:16
at ModuleJob.run (node:internal/modules/esm/module_job:271:25)
at async onImport.tracePromise.proto (node:internal/modules/esm/loader:578:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:116:5)
Node.js v22.14.0 still is not working
Assistant
import * as glob from "glob";
Then, depending on how you're using it, you can call:
glob.glob('pattern', options, callback);
or if you're using the Promise version:
const files = await glob.glob('*.js');
Option 2: Import named exports
According to the latest glob package docs (v8+), it exports a named function called glob (not as a default export).
So you could try:
import { glob } from "glob";
and then use glob as a function.
For example:
const files = await glob('*.js');
Additional notes:
Make sure you are using the latest version of the glob package if you want ESM support.
Check that your package.json has "type": "module" if you want to use ESM syntax.
If you are mixing CommonJS (require) with ESM (import), that could cause issues.
Summary
Replace:
import glob from "glob";
with either:
import * as glob from "glob";
or
import { glob } from "glob";
and adjust your usage accordingly.
If you want, share your current code snippet around the import glob line and how you are calling it, I can help you adjust it more precisely.
Make sure your code has:
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';
and not
import createFFmpeg from '@ffmpeg/ffmpeg';
or something else.
Check your package installation
Make sure you have installed the package:
npm install @ffmpeg/ffmpeg
Confirm you are running in an environment that supports ESM
Your .mjs extension and Node 22 are fine, but your package.json could have settings affecting this.
Simple test
Create a minimal test file test_ffmpeg.mjs:
import { createFFmpeg } from '@ffmpeg/ffmpeg';
console.log(typeof createFFmpeg);
Run it with:
node test_ffmpeg.mjs
You should see: function
If you get undefined or error, something is wrong with your import or package.
Summary
Make sure to import with named import syntax:
import { createFFmpeg } from '@ffmpeg/ffmpeg';
Ensure package is installed (npm install @ffmpeg/ffmpeg)
Check your node_modules/@ffmpeg/ffmpeg folder for presence
If the problem persists, please share your import lines or package.json dependencies and parts of the code using createFFmpeg.
The error:
SyntaxError: The requested module '@ffmpeg/ffmpeg' does not provide an export named 'createFFmpeg'
indicates that your Node.js runtime is trying to load @ffmpeg/ffmpeg as an ES module, but createFFmpeg is not a named export available in the module as loaded.
What is going on?
Possible reasons:
@ffmpeg/ffmpeg package version is old or incompatible.
The ESM support with named exports like createFFmpeg was added in newer versions.
If your installed version is old, it may not provide that export.
Your package might be installed incorrectly or cached with a CommonJS version.
Module resolution issues in Node.js?
How to fix
Step 1: Check installed package version and reinstall
Run in your terminal:
npm list @ffmpeg/ffmpeg
If it shows no installed package, or very old version, then install latest explicitly:
npm install @ffmpeg/ffmpeg@latest
Make sure your package.json shows the latest version under dependencies.
If the package doesn't provide ESM exports correctly, or your Node.js version or environment causes issues, you can try requiring it with CommonJS syntax through createRequire:
Or if your Node/Esm supports it (try this, but it might throw if @ffmpeg/ffmpeg is pure CommonJS):
import { FFmpeg } from '@ffmpeg/ffmpeg';
const ffmpeg = new FFmpeg({ log: true });
Why no createFFmpeg?
Some older versions or your particular package version only export the FFmpeg class, and expect the user to instantiate it.
Official docs / most modern examples use createFFmpeg, but if your installed package differs, then fallback to what your package exports.
Summing up
The module exports { FFmpeg } class, not named function createFFmpeg.
Instantiate the class directly with new FFmpeg(...).
Adjust your imports accordingly.
If you want me to help refactor your script to work with this, please paste your current import + ffmpeg initialization code snippet!
The error you are seeing:
Error: ffmpeg.wasm does not support nodejs
comes directly from the @ffmpeg/ffmpeg package and indicates that the ffmpeg.wasm version you installed is designed only for browser environments, not for Node.js.
What’s going on?
The @ffmpeg/ffmpeg package is primarily a WebAssembly (wasm)-based FFmpeg implementation intended for the browser.
It does not support Node.js out of the box because wasm binaries and the package expect some browser APIs.
When you run it in Node.js, it throws an error (ffmpeg.wasm does not support nodejs).
What to do?
Option 1: Use a Node.js-native FFmpeg library
If your goal is to work with FFmpeg in Node.js, you should use native bindings to FFmpeg or wrapper libraries built for Node.js, such as:
For example, using fluent-ffmpeg together with ffmpeg-static is a popular approach to run FFmpeg commands in Node.js.
Option 2: Run @ffmpeg/ffmpeg in Browser or with Node.js workarounds
If you want to still use @ffmpeg/ffmpeg (which is wasm-based):
It requires browser environment or a special Node.js WASM + DOM shim environment (complex setup).
It's not recommended for simple Node.js scripts.
Here’s a quick example of how to run FFmpeg in Node.js using fluent-ffmpeg:
Install packages:
npm install fluent-ffmpeg ffmpeg-static
Usage example in your compose_tiktok_video.mjs or test_ffmpeg.mjs:
import ffmpegPath from 'ffmpeg-static';
import ffmpeg from 'fluent-ffmpeg';
// Tell fluent-ffmpeg where the ffmpeg binary is
ffmpeg.setFfmpegPath(ffmpegPath);
ffmpeg()
.input('input.mp4')
.output('output.mp4')
.on('start', commandLine => {
console.log('Spawned FFmpeg with command:', commandLine);
})
.on('error', (err, stdout, stderr) => {
console.error('Error:', err.message);
console.error('FFmpeg stderr:', stderr);
})
.on('end', () => {
console.log('Processing finished successfully');
})
.run();
Summary
@ffmpeg/ffmpeg is intended for browser (WebAssembly) use and does not work directly in Node.js.
Use Node.js-native solutions instead (fluent-ffmpeg + ffmpeg-static).
This approach works with full native FFmpeg binary, very stable and widely used for video processing in Node.js.
If you want help rewriting your TikTok video composition script using fluent-ffmpeg + ffmpeg-static, share your current 5_compose_tiktok_video.mjs code and I can help you adapt it!