-
Notifications
You must be signed in to change notification settings - Fork 880
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
Unable to resolve some modules: "./lib-cov/fluent-ffmpeg" #573
Comments
Hey, This is weird, items in module.exports = process.env.FLUENTFFMPEG_COV ? require('./lib-cov/fluent-ffmpeg') : require('./lib/fluent-ffmpeg'); Do you happen to have the environment variable |
I exactly have the same code for index.js ! I am on Ubuntu 14.04 and i work with Meteor ! I tried to remove the npm package and reinstall it but it is same result. I also did Here is the line related to lib-cov in the makefile :
|
Hi Jaetoh, I'm having the exact same problem. Are you using webpack by any chance? I think that the issue is because of trying to solve the path statically: Here is the offending line: |
I'm not using webpack ! Did you figure out the warning ? |
@Jaetoh this is a Meteor bug. It parses source files and tries to include everything that is in a |
Given that webpack has issue resolving this, and that ES6 imports are not done conditionally, is this something you can consider fixing? |
I ran into this also when using Webpack as I'm building a desktop app using this library. The work around (if you are using Webpack):
If not using Webpack you could just put |
I'm running into the same problem with https://github.com/electron-userland/electron-builder |
New to javascript. I am using react-scripts and running into same issue
I can find
what should I do with it? replace with
|
@Jfeng3 assuming your
The important thing is it being an This depends how you are running Webpack, if you get an error like
|
this is still an issue for me when i do yarn add fluent-ffmpeg:
|
Hello all, |
fluent-ffmpeg/node-fluent-ffmpeg#573 Signed-off-by: Elliot Murphy <statik@users.noreply.github.com>
I am getting same issue in my Vue app, any idea how to solve this. |
Does somebody have experience what should to do in a react-app? I tried all offers but nothing works. |
If you are using webpack in react then add this configuration to your plugins object in webpack configuration
|
I think this works for many people but I am using Rollup and it's not working for me. I used the Rollup approach to set the environment variable. I ran this command but I get the same error: @kus do you have any idea why is this not working 😢 |
open replace the last section with:
|
i am using esbuild for bundle and running into same problem. |
I am facing the same issue now. Working on the Electron application and I really need to use FFmpeg features. "scripts": {
"dev": "node scripts/watch.mjs" And right at the beginning of which I have put: process.env.FLUENTFFMPEG_COV = false
process.env.NODE_ENV = 'development'
. . . Also tried with an empty string and a zero, but the issue still exists... Any idea, please? UPD: Just checked PR #945 and edited the package directly in my node_modules and it worked! Even if this package hadn't received updates since 2017, I hope it gets bumped soon 👀 |
This worked for me: new EnvironmentPlugin({
FLUENTFFMPEG_COV: '',
}) |
@max-programming @PAXANDDOS I was able to fix this in Vite/Rollup by adding the following line to my Vite config: export default defineConfig(() => ({
resolve: {
alias: {
'./lib-cov/fluent-ffmpeg': './lib/fluent-ffmpeg' // This line
},
},
})); |
If anyone is struggling with this issue in esbuild, I got it working by writing this small plugin: const path = require("path");
let resolveFfmpegPlugin = {
name: "resolveFfmpeg",
setup(build) {
build.onResolve({ filter: /lib-cov\/fluent-ffmpeg/ }, (args) => {
// fix https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/573
const actualPath = path.join(args.resolveDir, "lib", "fluent-ffmpeg.js");
return { path: actualPath };
});
},
}; |
where to add this in React project? |
plugins: [ where to add this in React project? |
1 similar comment
plugins: [ where to add this in React project? |
My solution when using
Might take up a bit more space but is completely fine for my specific use case. |
In rollup, this can be solved with the plugin @rollup/plugin-alias rollup.config.js import alias from "@rollup/plugin-alias";
export default {
plugins: [
alias({
entries: [
{ find: "./lib-cov/fluent-ffmpeg", replacement: "./lib/fluent-ffmpeg" },
]
})
]
} |
this worked for me!! thanks! |
This worked for me, just make sure to |
If you're using a .env file, be aware that
...will be evaluated to the true condition because
The empty string is falsy. |
For those using Note: I assume that you aren't using ffmpeg in your preload script. If you do, just copy over the import { defineConfig } from 'vite';
import electron from 'vite-plugin-electron';
export default defineConfig({
plugins: [
electron([
{
entry: "src/electron/node/main.ts", // wherever your main entrypoint
vite: {
build: {
rollupOptions: {
plugins: [
alias({
entries: [
{
find: "./lib-cov/fluent-ffmpeg",
replacement: "./lib/fluent-ffmpeg",
},
],
}),
],
},
},
},
},
{
entry: "src/electron/node/preload.ts", // wherever your preload entrypoint
onstart(options) {
// Notify the Renderer-Process to reload the page when the Preload-Scripts build is complete,
// instead of restarting the entire Electron App.
options.reload();
},
},
]),
]
}); |
Is there someone, who solved this issue with next js ? |
this config works
|
Is there someone, who solved this issue with laravel mix ? |
For people stumbling over this, this has been addressed but the changes have not been published since: Line 1 in 68d5c94
I suggest using something like https://www.npmjs.com/package/patch-package. yarn and pnpm have this feature built in, this is all mentioned in the readme for patch-package. |
For bundlers that do at least very basic dynamic import tracking, I believe the issue would persist. |
A simple patch using patch-package fixes this easily and reliably. Follow the instructions in the repo to install that and patch
|
Also stumbled upon this in a complete different setup (nuxt + layers + vite/rollup) |
@pablovoorvaart Thanks, I use this config since I discover your response, but I've this error when I build the project : Critical dependency: the request of a dependency is an expression
Import trace for requested module:
./node_modules/fluent-ffmpeg/lib/options/misc.js
./node_modules/fluent-ffmpeg/lib/fluent-ffmpeg.js
./node_modules/fluent-ffmpeg/index.js
./lib/ffmpeg.ts
./actions/index.ts
./app/(app)/(home)/page.tsx``` |
Hi !
I got this warning while running my Meteor app with the npm package fluent-ffmpeg. I don't really know what's wrong with this issue because my npm package worked well during more than 3 months. After I installed again all npm packages into my app, i got it.
Thank you in advance for any reply
The text was updated successfully, but these errors were encountered: