Skip to content
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

Using Webpack #39

Open
johnlop opened this issue Nov 6, 2019 · 12 comments
Open

Using Webpack #39

johnlop opened this issue Nov 6, 2019 · 12 comments

Comments

@johnlop
Copy link

johnlop commented Nov 6, 2019

Hi,
I'm adding Webpack to my NodeJS project but having issues with ffmpeg-installer. The build process works but when running the app I get the following error:

Cannot find module "[...]@ffmpeg-installer\win32-x64\package.json"

Not sure what to do to fix this but anyway I'm curious if anyone else has used Webpack with this package.

Info:

  • Node 10.15.0
  • NPM 6.10.3
  • Webpack 4.41.2
  • ffmpeg-installer 1.0.20
  • Windows 10 64b

Thanks.

@kribblo
Copy link
Owner

kribblo commented Nov 7, 2019

I've only ever used browserify, so not sure about this. If you look in your node_modules directory, is the file available there?

@johnlop
Copy link
Author

johnlop commented Nov 7, 2019

Yeah the file is there and the other modules seem ok.

@wangcheng007
Copy link

Yeah the file is there and the other modules seem ok.

hi,I met the same problem. Have you solved it?

@mpuz
Copy link

mpuz commented Feb 20, 2020

Same problem -
Error: Cannot find module 'C:\Users\user\Documents\PROJECTS\....\node_modules\@ffmpeg-installer\win32-x64\package.json'

@Fearycxy
Copy link

Same problem:
Cannot find module '....../node_modules/@ffmpeg-installer/darwin-x64/package.json'
in vue project and I tried yard remove and reinstall, doesn't work.

@pereslavtsev
Copy link

@johnlop with nodejs you can try to use something like this:

module.exports = {
  // ...some configs
  target: 'node',
  plugins: [
    new webpack.EnvironmentPlugin({
      FLUENTFFMPEG_COV: false,
    }),
  ],
  output: {
    libraryTarget: 'commonjs',
  },
  externals: [
    nodeExternals(),
    { '@ffmpeg-installer/ffmpeg': { commonjs: '@ffmpeg-installer/ffmpeg' } },
    { 'fluent-ffmpeg': { commonjs: 'fluent-ffmpeg' } },
  ],
}

but it can works if you use a webpack-node-externals - I don't know how to solve the issue without that

@chenweijianGZ
Copy link

Same problem ~~~

@Avngarde
Copy link

Avngarde commented Mar 4, 2021

@pereslavtsev Your solution worked for me. Using electron + webpack. Thanks!

@tulies
Copy link

tulies commented Sep 8, 2021

Same problem ...

@Bananamilk452
Copy link

i used this solution because some dependencies are using es6 export. (i'm using vue with electron-builder. not sure it works with plain webpack)
simillar with answer on above;

// webpack.config.js
module.exports = {
  // ...
  externals: [
    nodeExternals({
      modulesFromFile: {
        fileName: './package.json',
        includeInBundle: ['devDependencies', 'dependencies'],
        excludeFromBundle: ['excludeFromBundle'],
      },
    }),
  ],
}
// package.json
{
  // some configs
  // you dont have to remove this packages from dependencies
  "excludeFromBundle": {
    "@ffmpeg-installer/ffmpeg": "^1.1.0",
    "fluent-ffmpeg": "^2.1.2"
  }
}

@yunxiaopw
Copy link

Same problem - Error: Cannot find module 'C:\Users\user\Documents\PROJECTS\....\node_modules\@ffmpeg-installer\win32-x64\package.json'

Hello, have you solved this problem? How to solve it?

@MateusRosario
Copy link

@pereslavtsev 's solution worked for me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests