I want to convert mp4 to mp3 using the npm package 'fluent-ffmpeg’, in the express application it is working fine but not in NextJS 13, And even after removing the node_modules folder, package-lock.js and doing "npm install" again, it still didn't work. Does anyone have a solution for this?
This error is coming in the console.
> [email protected] dev
> next dev
▲ Next.js 14.0.2
- Local: http://localhost:3000
- Environments: .env.local
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
✓ Ready in 2.2s
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
⨯ ./node_modules/fluent-ffmpeg/index.js:1:48
Module not found: Can't resolve './lib-cov/fluent-ffmpeg'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./src/app/api/new/route.js
○ Compiling /not-found ...
(node:3236) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
⨯ ./node_modules/fluent-ffmpeg/index.js:1:48
Module not found: Can't resolve './lib-cov/fluent-ffmpeg'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./src/app/api/new/route.js
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/next isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
⨯ ./node_modules/fluent-ffmpeg/index.js:1:48
Module not found: Can't resolve './lib-cov/fluent-ffmpeg'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./src/app/api/new/route.js
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-ia32-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-arm64-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-win32-x64-msvc isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-musl isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-musl isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-darwin-x64 isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-x64-gnu isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
<w> [webpack.cache.PackFileCacheStrategy/webpack.FileSystemInfo] Managed item /Users/creative_aamir/Documents/My Website Projects /nextjs apps/testing-fluent-ffmpeg/node_modules/@next/swc-linux-arm64-gnu isn't a directory or doesn't contain a package.json (see snapshot.managedPaths option)
I also tried creating the webpack.config.js file in the root directory of the project but it did not work
<
import webpack from 'webpack'
module.exports = {
plugins: [
new webpack.DefinePlugin({
'process.env.FLUENTFFMPEG_COV': JSON.stringify(false),
}),
],
};
>
This is my src/app/api/new/route.js file code
import { NextResponse, NextRequest } from "next/server";
import ffmpeg from 'fluent-ffmpeg'
var command = ffmpeg()
export function GET(){
command.input('mp4/video.mp4')
.save('converted/audio.mp3')
return NextResponse.json('Done')
}
This is next.config.js file
/** @type {import('next').NextConfig} */
const nextConfig = {}
module.exports = nextConfig
This is package.js file
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"ffmpeg": "^0.0.4",
"fluent-ffmpeg": "^2.1.2",
"next": "14.0.2",
"react": "^18",
"react-dom": "^18",
"webpack": "^5.89.0"
}
}
How to fix this error?