illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.9k stars 1.51k forks source link

SyntaxError: Unexpected token Running application on Ubuntu 20.04 #520

Open sindrifj opened 2 years ago

sindrifj commented 2 years ago
node-media-server/src/api/controllers/streams.js:144
  streamStats.arguments = publisherSession?.publishArgs ?? {};
                                           ^

SyntaxError: Unexpected token .

This comes up when running the app.js on Ubuntu 20.04 LTS kernel 5.4.0-65-generic after removing line 144 it will run.

ajeje989 commented 2 years ago

same problem ? how to fix ?

willycosta commented 2 years ago

hey, your node version is outdated.

pls search tutorials: How to update node with Ubuntu.

rmckeel commented 2 years ago

Hey, for me node 12.22.11 did not work (macOS 12.3.1), but node 16.14.2 DID work.

This project needs to update its engines.node field in package.json. According to https://github.com/illuspas/Node-Media-Server/blob/master/package.json#L36, node-media-server v2.3.9 (which is the latest tag) should work on anything node >= 8.0.0, which it doesn't.

sindrifj commented 2 years ago

Aha i have version v10.19.0.

Flupster commented 2 years ago

My bad on this one, thanks for fixing it @illuspas :)

I always forget to support older versions of node.