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

TypeError: arg.replace is not a function #467

Closed
Differentunic opened this issue Jun 4, 2021 · 2 comments
Closed

TypeError: arg.replace is not a function #467

Differentunic opened this issue Jun 4, 2021 · 2 comments

Comments

@Differentunic
Copy link

Differentunic commented Jun 4, 2021

Error:

TypeError: arg.replace is not a function
at escapeArg (/var/www/html/node_modules/execa/lib/command.js:18:17)
at /var/www/html/node_modules/execa/lib/command.js:26:46
at Array.map ()
at getEscapedCommand (/var/www/html/node_modules/execa/lib/command.js:26:35)
at execa (/var/www/html/node_modules/execa/index.js:77:25)
at /var/www/html/index.js:25:22
at Layer.handle [as handle_request] (/var/www/html/node_modules/express/lib/router/layer.js:95:5)
at next (/var/www/html/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/var/www/html/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/var/www/html/node_modules/express/lib/router/layer.js:95:5)

My code:

const subprocess = execa(youtubedl.raw(URL, {
    noWarnings: true,
    noCallHome: true,
    noCheckCertificate: true,
    preferFreeFormats: true,
    youtubeSkipDashManifest: true
  }));
  subprocess.stdout.pipe(process.stdout);

  (async () => {
    const {stdout} = await subprocess;
    console.log('child output:', stdout);
  })();
@Differentunic
Copy link
Author

I'm not sure if I am misunderstanding how execa works.

@ehmicky
Copy link
Collaborator

ehmicky commented Jun 4, 2021

Hi @Differentunic,

The first argument of execa() must be a string (the command/binary) and the second argument must be an optional array of arguments. It appears that youtubedl.raw() returns an array, so this does not match how execa() is meant to be called.

The error message does not make this clear though, so I opened #468 to clarify this.

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

3 participants