Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

UnhandledPromiseRejectionWarning #327

Open
ultrasamad opened this issue Aug 27, 2020 · 1 comment
Open

UnhandledPromiseRejectionWarning #327

ultrasamad opened this issue Aug 27, 2020 · 1 comment

Comments

@ultrasamad
Copy link

I try running a basic example on this repo and I'm getting UnhandledPromiseRejectionWarning.
youtube-dl version: 3.0.2

This is my code:

const fs = require('fs')
const youtubedl = require('youtube-dl')

const url = 'https://www.youtube.com/watch?v=LXb3EKWsInQ'
const options = ['--format=18']
const outputFile = 'wildlife-4k.mp4'

const video = youtubedl(url, options, { cwd: __dirname })
video.on('info', function(info) {
  console.log('Download started')
  console.log('filename: ' + info._filename)
  console.log('size: ' + info.size)
})

video.pipe(fs.createWriteStream(outputFile))

and this is the error:

 UnhandledPromiseRejectionWarning: Error: Command failed with exit code 3221225781: C:\Users\Ibrahim\Desktop\Downloader\node_modules\youtube-dl\bin\youtube-dl.exe --dump-json --format=18 --encoding utf8 http://www.youtube.com/watch?v=LXb3EKWsInQ
    at makeError (C:\Users\$USER\Desktop\Downloader\node_modules\execa\lib\error.js:56:11)
    at handlePromise (C:\Users\$USER\Desktop\Downloader\node_modules\execa\index.js:114:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:17392) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:17392) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
@bighitbiker3
Copy link

bighitbiker3 commented Aug 28, 2020

Use the master branch npm i https://github.com/przemyslawpluta/node-youtube-dl.git

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

No branches or pull requests

2 participants