warren-bank / HLS-Proxy

Node.js server to proxy HLS video streams
http://webcast-reloaded.surge.sh/proxy.html
GNU General Public License v2.0
238 stars 68 forks source link

Can't start "SyntaxError: Invalid regular expression flags" #23

Closed ChronoBrake closed 1 year ago

ChronoBrake commented 1 year ago

Hey whe i wanna run it on latest version i get that error:

> @warren-bank/hls-proxy@3.2.2 sudo
> sudo node hls-proxy/bin/hlsd.js

/home/hlsproxy/HLS-Proxy/hls-proxy/manifest_parser.js:8
  m3u8_line_url:       /URI=["']([^"']+)["']/id
                       ^

SyntaxError: Invalid regular expression flags
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/hlsproxy/HLS-Proxy/hls-proxy/proxy.js:3:17)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
npm ERR! code 1
npm ERR! path /home/hlsproxy/HLS-Proxy
npm ERR! command failed
npm ERR! command sh -c sudo node hls-proxy/bin/hlsd.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-12-15T16_49_12_055Z-debug.log
warren-bank commented 1 year ago

I recently did a major rewrite. v1.0.0 marks the old design. v2.x marks some significant refactoring of code, but still (fundamentally) uses the old design. v3.x marks the new design.

The regex flag //d is only used by v3.x. This flag isn't supported by older versions of node. Off-hand, I'm not sure which version of node adds support for this flag; I'm currently using v16.14.0, and it works correctly.

warren-bank commented 1 year ago

according to this article, node added support at v16.x.

confirmed here

so.. to summarize:

warren-bank commented 1 year ago

I'll update the README (of each branch) to include this info.. and node version requirements.

update: info is now in README