Twilio + node.js

Do I need to install node.js on the server??

I can't find any tutorials on deployment not aimed at DevOps pros, but I've been told to upload "everything in the project" to the server ( implying: including the node_modules folder, further implying node.js should be installed on the server). This sounds weird to me and I'm not finding anything telling me explicitly TO install node.js on the server, but the tutorials all seem to end while still running on localhost so I have no idea.


  • Hi @EricB, Twilio Developer Educator here.

    I saw your other post about the Video repo. I need a bit more context to know how to help here.

    1. What are you trying to achieve by deploying? Do you want the entire project to run on the internet? Or do you just want a website that users can go to, while you run the token server on your local machine?
    2. When you are talking about "the server", what do you mean? What server do you have?
    3. I know you've mentioned deploying other web pages in the past. Were they just static web pages without dependencies?
    4. Have you deployed a web server (like the express server) before on your deployment service?

    A note on node_modules. They are downloaded libraries that the JavaScript files in the project rely on to work properly. You don't need to install node.js on a server in order for your JavaScript files to read those libraries. You may have deployed web pages that didn't require any npm packages (or the packages were retrieved from a CDN ... like you can see for bootstrap in the index.html file of the Video repo) in the past, but this particular project requires a few of them.

    However, this Video project has a frontend (the web page the users will see) and a backend. In order to deploy a backend server (the part of the project that provides the Token needed for the Video call to work), you need some sort of service that allows you to run node.js commands so that it can actually start the server. I can provide solutions for this if your specific deployment service doesn't allow for that, but I'm not quite sure what tech you're working with.

  • Clearly backend is not my specialty. I'm front-end and usually use node for templating tools and style systems so I'm used to compiling final code into build folders.

    1) Website with a unique URL. Marketing context.

    2) Server is the web hosting server with SSL. I'm using a testing server now and then later it will run on the client's servers.

    4) I don't have much experience with building backend tools, only interfacing with them. PHP years ago if that counts...

    4) My understanding and previous uses for express.js were entirely for local environments for prototypes. I learned yesterday that express could be run in a hosted environment.

    "You don't need to install node.js on a server in order for your JavaScript files to read those libraries." This just blew my mind. I thought node.js on the server was the service required to run node_modules scripts. It sounds like I need to contact the IT team to get this service running, but I'll need to figure out what to ask for.

  • Thanks for the context!

    Now that I'm actually digging into the repo, let's clear some things up/some wrong assumptions I may have had:

    Your intuition about needing node here are correct. This project is written in a way that does assume a node environment. There are ways around this (like manually managing dependency files and handling them in <script> tags or adding a build tool).

    @sstringer mentioned some great resources in her response to you in the other thread that may be a good starting point in building an application.

    You may also want to talk to IT or someone else at work that has opinions on how to best run a server with your particular setup. Otherwise, Twilio Functions are a way to do this on Twilio's servers. You will still need to modify this repo so that it's fetching the token from the correct endpoint.

    If you're comfortable with frontend development, you may want to use this repo as a base to design an application in your preferred framework (like React or Vue) which has some nice built-in build tools. You'll then need to just find a way to create and return an Access Token to your frontend (maybe there's already infrastructure set up at your work that can do this).

    Sorry I can't be of more help, but hopefully @sstringer's suggestions will point you in the right direction!

If this is an emergency, please contact Twilio Support. This is not an official Support channel.
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support