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

Error: Cannot find module #3

Closed
barbarosso opened this issue Feb 20, 2016 · 4 comments
Closed

Error: Cannot find module #3

barbarosso opened this issue Feb 20, 2016 · 4 comments

Comments

@barbarosso
Copy link

I just installed the library via npm, and that went ok.

Now i try to run following code

var ffmpeg = require('easy-ffmpeg');
var fs = require('fs');
var command = ffmpeg();

var stream  = fs.createWriteStream('outputfile.mp4');

ffmpeg('Renson A 960_56.mp4')
        .output(stream).on('progress', function(progress) {
        console.log('Processing: ' + progress.percent + '% done');
});

and when i run node script.js, I get following error.

Error: Cannot find module '/Users/pascal/Desktop/easy-ffmpeg/node_modules/easy-ffmpeg/ffmpeg/darwin/x64/ffmpeg.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Shouldn't the path be ffmpeg without the js?

Regards
Pascal

@konsumer
Copy link
Owner

Hmm, not sure why it's trying to require that js file at all, but I noticed that the path should be directly to ffmpeg runtime, not the directory. Try v0.0.10 (latest on npm) and let me know how it goes.

@barbarosso
Copy link
Author

@konsumer Hi, i just updated to v0.0.10.
I now get another error.

path.js:488
      throw new TypeError('Arguments to path.join must be strings');
            ^
TypeError: Arguments to path.join must be strings
    at Object.posix.join (path.js:488:13)
    at Object.<anonymous> (/Users/pascal/Desktop/easy-ffmpeg/node_modules/easy-ffmpeg/index.js:4:14)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/pascal/Desktop/easy-ffmpeg/ffmpeg.js:1:76)
    at Module._compile (module.js:460:26)

I think the problem lies in the fact that the variable arch isn't declared yet.

var p = path.join(__dirname, 'ffmpeg', process.platform, arch, 'ffmpeg')

Shouldn't the following line be moved above the path.join?

var arch = process.arch

If i update the code and rerun, the error is gone, but no encoding is done.

@konsumer
Copy link
Owner

Argh, that was a stupid error. Forgot to test. Updated to 0.0.11.

@barbarosso
Copy link
Author

Okay,
It works now 👍

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

2 participants