problem encountered running 'npm start' in "Programming WebRTC" book

Hello Karl @karlstolley,
In the section called “Finding Your Way Around the Code Directory” you write:
“…you can simply run npm start on your command line to fire up the server”.

But doing so I get:

ksrtc@0.2.0 start

PUBLIC=www DEBUG=signaling-server: node ./scripts/start-server

‘PUBLIC’ is not recognized as an internal or external command,
operable program or batch file.

Can you please help me with this.

Yehuda

Sure, Yehuda. Those are just shell variables, so let’s start with some really basic things:

  1. What operating system are you running?
  2. What version of node are you running (node -v will tell you)
  3. What version of npm are you running (npm -v for that)
  4. What exact command did you run? npm run start is what you need to run – ksrtc@0.2.0 is not itself executable.

Let me know if you have any success, or further trouble. We’ll get this sorted out!

Karl

Hi Karl @karlstolley , thanks for your quick response.

  1. I am doing this on Windows 10.`

node -v
v16.17.1

npm -v

8.19.2

  1. I ran “npm run start” on the book unzipped code folder from windows cmd and got the same result:

ksrtc@0.2.0 start
PUBLIC=www DEBUG=signaling-server: node ./scripts/start-server

‘PUBLIC’ is not recognized as an internal or external command,

operable program or batch file.

Yehuda

`

| karlstolley Author of WebRTC: Build Real-Time Web Applications in the Browser
21 October |

  • | - |

Sure, Yehuda. Those are just shell variables, so let’s start with some really basic things:

  1. What operating system are you running?
  2. What version of node are you running (node -v will tell you)
  3. What version of npm are you running (npm -v for that)
  4. What exact command did you run? npm run start is what you need to run – ksrtc@0.2.0 is not itself executable.

Let me know if you have any success, or further trouble. We’ll get this sorted out!

Karl

Hello Karl,

I tried the “npm start” on Ubuntu 22.04 and the server does work.
Is it supposed to work on windows also?

Thanks,
Yehuda

Thanks for circling back, Yehuda. I’ve been researching the topic, and this is a known limitation of using environment variables with npm running on Windows.

Would you be interested in checking to see if you have any better luck running the Bash terminal with the Ubuntu subsystem on Windows?

The book is written expecting a POSIX-style shell, which the windows default terminal is not. I will be sure to add more clear language about that so that other readers are aware.

As you suggested Karl, I tried “npm start” on Windows Subsystem for Linux - WSL - and it does work. Specifically the system was Ubuntu 20.04.5 LTS.

But I recommend installing node on WSL following Microsoft’s instructions described in
“Install Node.js on Windows Subsystem for Linux (WSL2)” - Set up Node.js on WSL 2 | Microsoft Learn as I was less lucky before I did so.

Yehuda