javascriptnode.jswebrtcsimplewebrtc

about running WEB Rtc sample


I cloned the files from google Lab where it says try the live demos. then I installed npm and i tryied to find the index.js which triggers the program to start, but there were few files which are gulpfile.babel.js / nightwatch.conf.js.

Before try this demo version, I followed the steps where googleTryCodeLab presents and in index.js, there was starting with 'use strict'. So I found that code in gulpfile.babel.js and I tried

node gulpfile.babel.js

and it produces the error, which is

import gulp from 'gulp'; ^^^^^^

SyntaxError: Cannot use import statement outside a module at Object.compileFunction (node:vm:355:18) at wrapSafe (node:internal/modules/cjs/loader:1022:15) at Module._compile (node:internal/modules/cjs/loader:1056:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10) at Module.load (node:internal/modules/cjs/loader:972:32) at Function.Module._load (node:internal/modules/cjs/loader:813:14) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) at node:internal/main/run_main_module:17:47

E:\webRtcProject\test\example\samples>node index.js node:internal/modules/cjs/loader:927 throw err;

Is there other way to start this demo version??


Solution

  • The samples repository is a collection of standalone HTML/JS pages. You can test them from a simple HTTP server like python -m SimpleHTTPServer

    The WebRTC codelab at https://codelabs.developers.google.com/codelabs/webrtc-web#2 is a different thing.