fluent-ffmpeg / node-fluent-ffmpeg

A fluent API to FFMPEG (http://www.ffmpeg.org)
MIT License
7.93k stars 880 forks source link

encloseJS : minor problem with a require() #525

Closed Malke closed 8 years ago

Malke commented 8 years ago

hello, I report just an error when I use encloseJS for a program which owns fluent-ffmpeg in its modules. It said me this error :

...\node_modules\fluent-ffmpeg\lib-cov\options\misc.js
  warning  Cannot resolve 'modulePath'
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option

...\node_modules\fluent-ffmpeg\lib\options\misc.js
  warning  Cannot resolve 'modulePath'
  Use a string literal as argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option`

It seems the error is to have a "require" which does not have a string format as argument (litterally).

You can find at the line 53 of lib-cov/option/misc.js : var module = require(modulePath);

It will be great if you can change for : var module = require( "module_name" );

thanks

njoyard commented 8 years ago

That's not possible. This require() call is required for preset functionality.

IMO you should not use an exe builder. Nodejs runs on all platforms and there are tools to help package it with your app without building an exe. Or at least use one that is compatible with all nodejs features (require(some variable string) is valid nodejs).

andykais commented 7 years ago

perhaps this could be reopened? Webpack returns a similar error

Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/options/inputs.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/options/audio.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/options/video.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/options/videosize.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/options/output.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/options/custom.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/options/misc.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib/options/inputs.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib/options/audio.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib/options/video.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib/options/videosize.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib/options/output.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib/options/custom.js'
Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib/options/misc.js'

/watcher_es6/dist/app.js:6506
    __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"./options/inputs\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()))(FfmpegCommand.prototype);
                                                                                                                                                       ^

Error: Cannot find module "./options/inputs"
    at webpackMissingModule (/watcher_es6/dist/app.js:6506:66)
    at Object.<anonymous> (/watcher_es6/dist/app.js:6506:159)
    at Object.<anonymous> (/watcher_es6/dist/app.js:6564:31)
    at __webpack_require__ (/watcher_es6/dist/app.js:20:30)
    at Object.BASE (/watcher_es6/dist/app.js:2619:76)
    at __webpack_require__ (/watcher_es6/dist/app.js:20:30)
    at Object.<anonymous> (/watcher_es6/dist/app.js:2481:22)
    at __webpack_require__ (/watcher_es6/dist/app.js:20:30)
    at Object.<anonymous> (/watcher_es6/dist/app.js:57:20)
    at __webpack_require__ (/watcher_es6/dist/app.js:20:30)
Failed to compile.

Module build failed: Error: ENOENT: no such file or directory, open '/watcher_es6/node_modules/fluent-ffmpeg/lib-cov/fluent-ffmpeg.js'

in this code

import ffmpeg from 'ffmpeg'

let transcoder = ffmpeg(mediaFile)
  .withVideoCodec('libvpx')
  .withAudioCodec('libvorbis')
  .withVideoBitrate(2048)
  .addOptions(['-qmin 0', '-qmax 30', '-crf 5'])
  .saveToFile(convertedFilename)

transcoder
  .on('end', (stdout) => {
    console.log('done')
  })
  .on('error', (error) => {
    console.error(error)
  })
njoyard commented 7 years ago

This is still not a fluent-ffmpeg issue. My comment above still applies.