node-ytdl-core: Invalid regular expression: missing /

  • Are you on the latest version of ytdl-core?
    • yes
  • Search the list of issues for a possible duplicate.
    • #1141 (closed for a few months now)
SyntaxError: Invalid regular expression: missing /
  File "node:vm", line 100, col 7, in new Script
  File "/app/node_modules/ytdl-core/lib/sig.js", line 116, col 51, in exports.decipherFormats
    const nTransformScript = functions.length > 1 ? new vm.Script(functions[1]) : null;
  File "node:internal/process/task_queues", line 95, col 5, in process.processTicksAndRejections
  File "index 0", in Promise.all
  File "/app/node_modules/ytdl-core/lib/info.js", line 401, col 17, in exports.getInfo
    let results = await Promise.all(funcs);

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 29
  • Comments: 27

Most upvoted comments

Temporary fixed solution is downgrading ytdl-core version forked by @GreepTheSheep:

npm i ytdl-core@https://github.com/GreepTheSheep/node-ytdl-core

For mine, this fixed the "Invalid regular expression: missing / "

I recommend using @distubejs fork since it is active, has fast bug fixes, and has better performance with undici. npm i @distube/ytdl-core

If you don’t want to change your package name, you can overwrite the original package with this command. npm i ytdl-core@npm:@distube/ytdl-core

It should work better since #1217 patch is copied from this fork

For me the patch by @khlevon worked

"ytdl-core": "https://github.com:khlevon/node-ytdl-core.git#v4.11.4-patch.2"

@Mittelblut9 in your patch one important line is removed, here is a correct one https://gist.github.com/talyuk/6f197e6a58b7b8107a7c2d7f442b97ae

Fixed 😅🫡

@Mittelblut9 in your patch one important line is removed, here is a correct one https://gist.github.com/talyuk/6f197e6a58b7b8107a7c2d7f442b97ae

“ytdl-core”: “https://github.com:khlevon/node-ytdl-core.git#v4.11.4-patch.2”

It works perfectly on localhost however I am not able to deploy to Firebase Functions after adding this to package.json. Any solution?

This worked for me: Using last ytdl version (same download speed)

  1. delete node_module, package-lock.json
  2. “ytdl-core”: “github:milanbabiclibrafire/node-ytdl-core”
  3. npm i