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.96k stars 1.52k forks source link

Installation failed using readme on windows #157

Open jordanvanbergen opened 5 years ago

jordanvanbergen commented 5 years ago

Github version:

node app.js internal/modules/cjs/loader.js:583 throw err; ^

Error: Cannot find module 'D:\My-Mediaserver\nms\app.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)


NodeJS version

Not a clue what to do after:

mkdir nms cd nms npm install node-media-server

This is working and then what?

Installed: 10.15.0 LTS Recommended For Most Users Windows 10 (x64)

TheAntinormal commented 5 years ago

If npm worked installing node-media-server, all you need to do is to

1- Create on your desktop (for example) a file named server.js 2- Put this into server.js :

const { NodeMediaServer } = require('node-media-server');

const config = { rtmp: { port: 1935, chunk_size: 60000, gop_cache: true, ping: 60, ping_timeout: 30 }, http: { port: 8000, allow_origin: '*' } };

var nms = new NodeMediaServer(config) nms.run();

3- Open CMD, cd to the directory where server.js is and run "node server.js" 4- It should be working, now you go stream with rtmp://localipaddress/live, the streamname is of your choice. 5- Try to play rtmp://localipaddress/live/streamname into VLC or else, and it should work :)

jordanvanbergen commented 5 years ago

If npm worked installing node-media-server, all you need to do is to

1- Create on your desktop (for example) a file named server.js 2- Put this into server.js :

const { NodeMediaServer } = require('node-media-server');

const config = { rtmp: { port: 1935, chunk_size: 60000, gop_cache: true, ping: 60, ping_timeout: 30 }, http: { port: 8000, allow_origin: '*' } };

var nms = new NodeMediaServer(config) nms.run();

3- Open CMD, cd to the directory where server.js is and run "node server.js" 4- It should be working, now you go stream with rtmp://localipaddress/live, the streamname is of your choice. 5- Try to play rtmp://localipaddress/live/streamname into VLC or else, and it should work :)

Thanks for the answer. I was able to start it but this explanation is even better. Thank you!

iamgmujtaba commented 5 years ago

I am using Ubuntu and getting this error. Please help me

Desktop/nms/Node-Media-Server/server.js:1 (function (exports, require, module, filename, dirname) { const {NodeMediaServer} = require('node-media-server'); ^ SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Function.Module.runMain (module.js:442:10) at startup (node.js:136:18) at node.js:966:3